当前位置: 首页>>代码示例>>C#>>正文


C# GamePlayer.SetGold方法代码示例

本文整理汇总了C#中Game.Server.GameObjects.GamePlayer.SetGold方法的典型用法代码示例。如果您正苦于以下问题:C# GamePlayer.SetGold方法的具体用法?C# GamePlayer.SetGold怎么用?C# GamePlayer.SetGold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game.Server.GameObjects.GamePlayer的用法示例。


在下文中一共展示了GamePlayer.SetGold方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnRemovedPlayer

        public override void OnRemovedPlayer(BaseSceneGame game, GamePlayer player)
        {
            base.OnRemovedPlayer(game, player);
            
            TankData data = game.Data;
            if(data == null)
            {
                if (game.GameState == eGameState.FREE || game.GameState == eGameState.PAIRUP || game.GameState == eGameState.OVER)
                {
                    if (game.Count == 0)
                    {
                        game.StopTimer();

                        if (game.RoomType == eRoomType.PAIRUP)
                        {
                            PairUpMgr.RemovefromPairUpMgr(game);
                        }
                        else
                        {
                            game.GameState = eGameState.FREE;
                        }
                    }
                }

                return;
            }

            if (!data.Players.ContainsKey(player))
            {
                return;
            }

            //if (game.GameState == eGameState.PLAY || game.GameState == eGameState.LOAD)
            //{
            //    int disLevel = (data.TotalLevel - data.persons[player.CurrentTeamIndex].TotalLevel) / (data.TotalPerson - game.Data.persons[player.CurrentTeamIndex].TeamPerson) - data.persons[player.CurrentTeamIndex].AveLevel;
            //    int GP = (int)(20 * (1 - data.Players[player].TotalKill * 0.1 - disLevel * 0.1) * 0.8);

            //    if (GP > 1 && player.PlayerCharacter.Grade > 10)
            //        player.SetGP(-GP);
            //}

            //data.Players[player].State = TankGameState.LOSE;
            data.Players[player].Lose();

            if (game.GameState == eGameState.LOAD && player.CurrentGameState != ePlayerGameState.FINISH)
            {
                CanStartGame(game);
            }

            if (game.GameState == eGameState.OVER)
            {
                byte index = data.GetCards();
                if (data.Players[player].IsTakeOut)
                {
                    GSPacketIn pkg = new GSPacketIn((int)ePackageType.GAME_TAKE_OUT, player.PlayerCharacter.ID);
                    pkg.WriteByte(index);
                    ThreadSafeRandom rand = new ThreadSafeRandom();
                    int gold = data.GetRandomGold(game.RoomType);
                    player.SetGold(gold, Game.Server.Statics.GoldAddType.Cards);
                    pkg.WriteByte(1);
                    pkg.WriteInt(gold);
                    player.Out.SendTCP(pkg);
                }
            }

            if (!CanStopGame(game, data) && game.GameState == eGameState.PLAY)
            {
                if (game.RoomType == eRoomType.PAIRUP)
                {
                    player.PlayerCharacter.Escape++;
                    player.PlayerCharacter.Total++;
                }

                if (player == data.CurrentIndex && game.Data.Count > 0)
                    SendPlayFinish(game, player);
                //else if (game.Data.Count > 0)
                //{
                //    int Count = game.Data.GetPlayFinishCount();
                //    if (Count == game.Data.Count)
                //        SendPlayFinish(game, player);
                //}
            }


            if (game.GameState == eGameState.FREE || game.GameState == eGameState.PAIRUP || game.GameState == eGameState.OVER)
            {
                data.Players.Remove(player);
            }

            if (game.GameState == eGameState.OVER && 8 - game.Data.ArkCount == game.Data.Count)
            {
                OnShowArk(game, player);
            }

            if (game.Data.Count == 0)
            {
                game.StopTimer();
                game.GameState = eGameState.FREE;
                game.Data.Players.Clear();

//.........这里部分代码省略.........
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:101,代码来源:TankGameLogicProcessor.cs


注:本文中的Game.Server.GameObjects.GamePlayer.SetGold方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。