Пример #1
0
        public void AddState(StateSkill skill)
        {
            skill.SetStateInfo(this);
            this.playerCardState.Add(skill);
            LogsSystem.Instance.Print(string.Format("英雄 {0} 获得了状态 {1} ,持续 {2} 回合", this.cardName, skill.skillName, skill.GetRemainRounds()), LogLevel.GAMEDETAIL);

            //通过技能的USE操作添加
            //TcpServer.Instance.GetTCPDataSender().SendStateOperate(skill, this, OperateStateData.StateOperateCode.AddState, cardOwnerPostion, cardRoom);
        }
Пример #2
0
 /// <summary>
 /// 附加状态
 /// </summary>
 public void AppendState(StateSkill state)
 {
     this.playerCardState.Add(state);
     LogsSystem.Instance.Print(string.Format("卡片{0}获得了状态{1}", this.cardName, state.skillName), LogLevel.GAMEDETAIL);
 }
Пример #3
0
        /// <summary>
        /// 移除状态
        /// </summary>
        public void RemoveState(StateSkill skill)
        {
            if (playerCardState.Contains(skill))
            {
                this.playerCardState.Remove(skill);
                LogsSystem.Instance.Print(string.Format("英雄 {0} 移除了状态 {1}", this.cardName, skill.skillName), LogLevel.GAMEDETAIL);

                //向服务器请求去除状态
                TcpServer.Instance.GetTCPDataSender().SendStateOperate(skill, this, OperateStateData.StateOperateCode.RemoveState, cardOwnerPostion, cardRoom);
            }
            else
            {
                LogsSystem.Instance.Print("卡片上不具备该技能:" + skill.skillName, LogLevel.WARN);
            }
        }
Пример #4
0
        /// <summary>
        /// 向客户端发送状态修改操作的请求
        /// </summary>
        public void SendStateOperate(StateSkill skill, PlayerCard operateCard, int operateType, int operatePosition, GameRoom gameRoom)
        {
            OperateStateData detail = new OperateStateData();
            detail.skillID = skill.skillID;
            detail.stateOperate = operateType;
            detail.ownerCardUUID = operateCard.cardUUID;
            detail.appendData = skill.GenerateSkillAppendData();//将技能生成的数据附加值传递
            switch (operateCard.GetCardOwnerPosition())
            {
                case 0://A
                    {
                        detail.operatePlayerPosition = 0;
                        detail.operatePlayerUid = gameRoom.playerSocketA.playerInfo.playerUid;
                        detail.operatePlayerUUID = gameRoom.playerSocketA.playerInfo.playerUUID;
                        break;
                    }
                case 1://B
                    {
                        detail.operatePlayerPosition = 1;
                        detail.operatePlayerUid = gameRoom.playerSocketB.playerInfo.playerUid;
                        detail.operatePlayerUUID = gameRoom.playerSocketB.playerInfo.playerUUID;
                        break;
                    }
                default:
                    {
                        LogsSystem.Instance.Print("错误:卡片拥有者的位置出现错误:" + operateCard.GetCardOwnerPosition(), LogLevel.WARN);
                        break;
                    }
            }

            GameData data = new GameData();
            data.returnCode = ReturnCode.Success;
            data.roomID = gameRoom.roomID;
            data.operateCode = OperateCode.OperateState;
            data.operateData = JsonCoding<OperateStateData>.encode(detail);

            gameRoom.SendOperateToAllPlayer(data);
        }