public override void BackState(UIStateMsg msg, params object[] paras) { if (History.Count > 0) { var t = History.Pop(); BattleData.Instance.Agent.SelectCards.Clear(); BattleData.Instance.Agent.SelectPlayers.Clear(); if (t == typeof(StateIdle)) { //一般是多次行动时的取消 Current.Process(msg, paras); BattleData.Instance.Agent.SelectSkill = null; BattleData.Instance.Agent.SelectArgs.Clear(); MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer); MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard); MessageSystem <MessageType> .Notify(MessageType.AgentSelectSkill); } else { ChangeState(t, false, msg, paras); } } }
public void OnEventTrigger(MessageType eventType, params object[] parameters) { switch (eventType) { case MessageType.TURNBEGIN: turnBegin = parameters[0] as network.TurnBegin; break; case MessageType.GAMEINFO: gameInfo = parameters[0] as network.GameInfo; break; case MessageType.COMMANDREQUEST: cmdReq = parameters[0] as network.CommandRequest; break; case MessageType.ERROR: var error = parameters[0] as network.Error; if (error.id == 30) { //离开房间 var idx = PlayerInfos.FindIndex(u => { return(u != null && u.id == error.dst_id); }); if (!DisConnectedPlayer.Contains((uint)error.dst_id)) { DisConnectedPlayer.Add((uint)error.dst_id); MessageSystem <MessageType> .Notify(MessageType.PlayerLeave, error.dst_id, idx); } } break; } }
public void RemoveAllSelectPlayer() { SelectPlayers.Clear(); MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer); FSM.HandleMessage(UIStateMsg.ClickPlayer); }
public void ChangeSelectSkill(uint?skillID) { SelectSkill = skillID; MessageSystem <MessageType> .Notify(MessageType.AgentSelectSkill); FSM.HandleMessage(UIStateMsg.ClickSkill); }
public override void Process(UIStateMsg msg, params object[] paras) { switch (msg) { case UIStateMsg.ClickSkill: if (BattleData.Instance.Agent.SelectSkill == null) { //取消技能 stateMachine.BackState(msg, paras); BattleData.Instance.Agent.SelectCards.Clear(); BattleData.Instance.Agent.SelectPlayers.Clear(); BattleData.Instance.Agent.SelectArgs.Clear(); MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer); MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard); MessageSystem <MessageType> .Notify(MessageType.CloseNewArgsUI); } else { //点了别的技能 stateMachine.ChangeState <StateSkill>(msg, false, BattleData.Instance.Agent.SelectSkill, paras); } break; case UIStateMsg.ClickCard: case UIStateMsg.ClickPlayer: case UIStateMsg.ClickArgs: base.Process(msg, paras); break; } }
public void AddSelectArgs(List <uint> args) { SelectArgs.Clear(); SelectArgs.AddRange(args); MessageSystem <MessageType> .Notify(MessageType.AgentSelectArgs); FSM.HandleMessage(UIStateMsg.ClickArgs); }
public virtual void Awake() { MessageSystem <MessageType> .Notify(MessageType.OnUICreate, this); CanvasGroup = GetComponent <CanvasGroup>(); Canvas = GetComponent <Canvas>(); Canvas.renderMode = RenderMode.ScreenSpaceCamera; Canvas.worldCamera = Camera.main; }
public void RemoveSelectPlayer(uint playerID) { if (SelectPlayers.Contains(playerID)) { SelectPlayers.Remove(playerID); } MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer); FSM.HandleMessage(UIStateMsg.ClickPlayer); }
public void RemoveSelectCard(uint cardID) { if (SelectCards.Contains(cardID)) { SelectCards.Remove(cardID); } MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard); FSM.HandleMessage(UIStateMsg.ClickCard); }
private void onUIStateChange() { if (!BattleData.Instance.IsStarted) { return; } //UI状态变化,确认哪些能够选择 foreach (var v in cardUIs) { if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, v.Card, isShowCovered)) { v.IsEnable = true; } else { v.IsEnable = false; } } foreach (var v in skillUIs) { if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, v.Skill)) { v.IsEnable = true; } else { v.IsEnable = false; } } for (int i = 0; i < players.Count; i++) { if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, BattleData.Instance.GetPlayerInfo((uint)BattleData.Instance.PlayerIdxOrder[i]))) { players[i].IsEnable = true; } else { players[i].IsEnable = false; } } btnOK.gameObject.SetActive(BattleData.Instance.Agent.PlayerRole.CheckOK(BattleData.Instance.Agent.FSM.Current.StateNumber, BattleData.Instance.Agent.SelectCards, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectSkill)); btnCancel.gameObject.SetActive(BattleData.Instance.Agent.PlayerRole.CheckCancel(BattleData.Instance.Agent.FSM.Current.StateNumber, BattleData.Instance.Agent.SelectCards, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectSkill)); btnResign.gameObject.SetActive(BattleData.Instance.Agent.PlayerRole.CheckResign(BattleData.Instance.Agent.FSM.Current.StateNumber)); btnSpecial.gameObject.SetActive(BattleData.Instance.Agent.PlayerRole.CheckBuy(BattleData.Instance.Agent.FSM.Current.StateNumber) || BattleData.Instance.Agent.PlayerRole.CheckExtract(BattleData.Instance.Agent.FSM.Current.StateNumber) || BattleData.Instance.Agent.PlayerRole.CheckSynthetize(BattleData.Instance.Agent.FSM.Current.StateNumber)); btnCovered.gameObject.SetActive(BattleData.Instance.Agent.PlayerRole.HasCoverd); MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer); MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard); MessageSystem <MessageType> .Notify(MessageType.AgentSelectSkill); }
public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras) { switch (state) { case 902: case 906: OKAction = () => { if (state == 901) { additionalState = 901; } sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>() { 1 }); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; CancelAction = () => { sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>() { 0 }); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, string.Format("是否发动{0}", Skills[state].SkillName)); return; case 905: OKAction = () => { sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; CancelAction = () => { BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init); }; return; } base.UIStateChange(state, msg, paras); if (additionalState == 901) { //这代码真傻...应该做成list的 //但懒得改了 var t1 = OKAction; var t2 = ResignAction; OKAction = () => { t1(); additionalState = 0; }; ResignAction = () => { t2(); additionalState = 0; }; } }
public void OnEventTrigger(MessageType eventType, params object[] parameters) { switch (eventType) { case MessageType.ROOMLISTRESPONSE: var roomListProto = parameters[0] as network.RoomListResponse; RoomInfo = roomListProto.rooms.OrderBy(t => t.playing).ThenBy(t => t.room_id).ToList(); MessageSystem <MessageType> .Notify(MessageType.RoomList); break; } }
public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras) { switch (state) { case 902: case 906: OKAction = () => { if (state == 901) { additionalState = 901; } if (state == 902) { IsStart = true; } sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>() { 1 }); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; CancelAction = () => { sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>() { 0 }); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, StateHint.GetHint(state)); return; case 905: if (BattleData.Instance.Agent.SelectPlayers.Count == 1 && BattleData.Instance.Agent.SelectCards.Count == 2) { sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); return; } ; CancelAction = () => { BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init); }; MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, StateHint.GetHint(state)); return; } base.UIStateChange(state, msg, paras); }
public override void Awake() { MessageSystem <MessageType> .Regist(MessageType.RoomIDChange, this); MessageSystem <MessageType> .Regist(MessageType.ChatChange, this); MessageSystem <MessageType> .Regist(MessageType.ChooseRole, this); MessageSystem <MessageType> .Regist(MessageType.PlayerLeave, this); MessageSystem <MessageType> .Regist(MessageType.PlayerIsReady, this); MessageSystem <MessageType> .Regist(MessageType.PlayerNickName, this); MessageSystem <MessageType> .Regist(MessageType.PlayerTeamChange, this); MessageSystem <MessageType> .Regist(MessageType.LEADERREQUEST, this); MessageSystem <MessageType> .Regist(MessageType.GameStart, this); MessageSystem <MessageType> .Regist(MessageType.ERROR, this); foreach (var v in players) { v.Reset(); } roomTitle.text = string.Format("{0} {1}", Lobby.Instance.SelectRoom.room_id, Lobby.Instance.SelectRoom.room_name); if (Lobby.Instance.SelectRoom.max_player == 4) { GameObject.Destroy(players[5].gameObject); GameObject.Destroy(players[4].gameObject); players.RemoveRange(4, 2); } for (int i = 0; i < BattleData.Instance.PlayerInfos.Count; i++) { MessageSystem <MessageType> .Notify(MessageType.PlayerIsReady, i, BattleData.Instance.PlayerInfos[i].ready); MessageSystem <MessageType> .Notify(MessageType.PlayerNickName, i, BattleData.Instance.PlayerInfos[i].nickname); MessageSystem <MessageType> .Notify(MessageType.PlayerTeamChange, i, BattleData.Instance.PlayerInfos[i].team); } root.localPosition = new Vector3(1280, 0, 0); root.DOLocalMoveX(0, 1).OnComplete(() => { btnExit.interactable = true; }); btnChooseRedTeam.onClick.AddListener(delegate { chooseTeam(Team.Red); }); btnChooseBlueTeam.onClick.AddListener(delegate { chooseTeam(Team.Blue); }); btnChooseRandomTeam.onClick.AddListener(delegate { chooseTeam(Team.Other); }); btnBecomeLeader.onClick.AddListener(delegate { chooseLeader(true); }); btnNotLeader.onClick.AddListener(delegate { chooseLeader(false); }); base.Awake(); }
public override void Enter(UIStateMsg msg, params object[] paras) { BattleData.Instance.Agent.SelectCards.Clear(); BattleData.Instance.Agent.SelectPlayers.Clear(); BattleData.Instance.Agent.SelectSkill = null; MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer); MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard); MessageSystem <MessageType> .Notify(MessageType.AgentSelectSkill); base.Enter(msg, paras); }
private void onUIStateChange() { //UI状态变化,确认哪些能够选择 foreach (var v in cardUIs) { if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, v.Card, isShowCovered)) { v.IsEnable = true; } else { v.IsEnable = false; } } foreach (var v in skillUIs) { if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, v.Skill)) { v.IsEnable = true; } else { v.IsEnable = false; } } foreach (var v in players.Keys) { if (BattleData.Instance.Agent.PlayerRole.CanSelect(BattleData.Instance.Agent.FSM.Current.StateNumber, BattleData.Instance.PlayerInfos[v])) { players[v].IsEnable = true; } else { players[v].IsEnable = false; } } btnOK.interactable = BattleData.Instance.Agent.PlayerRole.CheckOK(BattleData.Instance.Agent.FSM.Current.StateNumber, BattleData.Instance.Agent.SelectCards, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectSkill); btnCancel.interactable = BattleData.Instance.Agent.PlayerRole.CheckCancel(BattleData.Instance.Agent.FSM.Current.StateNumber, BattleData.Instance.Agent.SelectCards, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectSkill); BtnResign.interactable = BattleData.Instance.Agent.PlayerRole.CheckResign(BattleData.Instance.Agent.FSM.Current.StateNumber); btnBuy.interactable = BattleData.Instance.Agent.PlayerRole.CheckBuy(BattleData.Instance.Agent.FSM.Current.StateNumber); btnExtract.interactable = BattleData.Instance.Agent.PlayerRole.CheckExtract(BattleData.Instance.Agent.FSM.Current.StateNumber); btnSynthetize.interactable = BattleData.Instance.Agent.PlayerRole.CheckSynthetize(BattleData.Instance.Agent.FSM.Current.StateNumber); btnCovered.interactable = BattleData.Instance.Agent.PlayerRole.HasCoverd; MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer); MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard); MessageSystem <MessageType> .Notify(MessageType.AgentSelectSkill); }
public void AddSelectCard(uint cardID) { if (!SelectCards.Contains(cardID)) { SelectCards.Add(cardID); while (SelectCards.Count > PlayerRole.MaxSelectCard(FSM.Current.StateNumber)) { SelectCards.RemoveAt(0); } } MessageSystem <MessageType> .Notify(MessageType.AgentSelectCard); FSM.HandleMessage(UIStateMsg.ClickCard); }
public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras) { switch (state) { case 801: if (BattleData.Instance.Agent.SelectPlayers.Count == 2 && BattleData.Instance.Agent.SelectCards.Count == 1) { sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state, BattleData.Instance.Agent.SelectArgs); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); return; } ; CancelAction = () => { BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init); }; MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, StateHint.GetHint(state)); return; case 804: if (BattleData.Instance.Agent.SelectPlayers.Count == 2) { sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state, BattleData.Instance.Agent.SelectArgs); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); return; } ; MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, StateHint.GetHint(state)); CancelAction = () => { BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init); }; return; case 803: if (BattleData.Instance.Agent.SelectPlayers.Count == 1 && BattleData.Instance.Agent.SelectCards.Count == 1) { sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state, BattleData.Instance.Agent.SelectArgs); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); } ; CancelAction = () => { BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init); }; MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, StateHint.GetHint(state)); return; } base.UIStateChange(state, msg, paras); }
public void GetRoomList() { var proto = new network.RoomListRequest() { role_strategy = network.ROLE_STRATEGY.ROLE_STRATEGY_ALL }; GameManager.TCPInstance.Send(new Protobuf() { Proto = proto, ProtoID = ProtoNameIds.ROOMLISTREQUEST }); RoomInfo = null; MessageSystem <MessageType> .Notify(MessageType.RoomList); }
public void OnEventTrigger(MessageType eventType, params object[] parameters) { switch (eventType) { case MessageType.ROLEREQUEST: var proto = parameters[0] as network.RoleRequest; RoleStrategy = proto.strategy; CanIChoose = proto.id == BattleData.Instance.PlayerID; RoleIDs = proto.role_ids; MessageSystem <MessageType> .Notify(MessageType.ChooseRole, RoleStrategy); break; } }
private void onBtnGiveUpClick() { PollingResponse proto = new PollingResponse() { option = 1 }; GameManager.TCPInstance.Send(new Protobuf() { Proto = proto, ProtoID = ProtoNameIds.POLLINGRESPONSE }); MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, "已投票,请稍等"); GameManager.UIInstance.PopWindow(Framework.UI.WinMsg.None); }
public override void Awake() { MessageSystem <MessageType> .Regist(MessageType.RoomList, this); MessageSystem <MessageType> .Regist(MessageType.EnterRoom, this); MessageSystem <MessageType> .Regist(MessageType.ERROR, this); root.localPosition = new Vector3(Screen.width, 0, 0); root.DOLocalMoveX(0, 1.0f); Lobby.Instance.GetRoomList(); MessageSystem <MessageType> .Notify(MessageType.PlayBGM); base.Awake(); }
public override void Enter(UIStateMsg msg, params object[] paras) { var canUseHealCount = BattleData.Instance.Agent.Cmd.args[3]; var harmPoint = BattleData.Instance.Agent.Cmd.args[1]; var selectList = new List <List <uint> >(); //服务器默认玩家有治疗时才会发这个响应 for (uint i = Math.Min(canUseHealCount, harmPoint); i > 0; i--) { selectList.Add(new List <uint>() { i }); } MessageSystem <MessageType> .Notify(MessageType.ShowArgsUI, "Heal", selectList); base.Enter(msg, paras); }
public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras) { switch (state) { case 502: OKAction = () => { sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, BattleData.Instance.Agent.SelectCards); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; CancelAction = () => { sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; MessageSystem <MessageType> .Notify(MessageType.SendHint, StateHint.GetHint(state)); return; case 503: OKAction = () => { IsStart = true; sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>() { 1 }); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; CancelAction = () => { sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>() { 0 }); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; MessageSystem <MessageType> .Notify(MessageType.SendHint, StateHint.GetHint(state)); return; } base.UIStateChange(state, msg, paras); }
public void OnEventTrigger(MessageType eventType, params object[] parameters) { switch (eventType) { case MessageType.ROOMLISTRESPONSE: var roomListProto = parameters[0] as network.RoomListResponse; RoomInfo = roomListProto.rooms.OrderBy(t => t.playing).ThenBy(t => t.room_id).ToList(); if (PlayerPrefs.HasKey("lastGame")) { network.RoomListResponse.RoomInfo room = getRoomInfoByID(PlayerPrefs.GetInt("lastGame")); if (room != null) { JoinRoom(room); } } MessageSystem <MessageType> .Notify(MessageType.RoomList); break; } }
public override void Process(UIStateMsg msg, params object[] paras) { switch (msg) { case UIStateMsg.ClickCard: case UIStateMsg.ClickPlayer: if (BattleData.Instance.Agent.SelectCards.Count == 1 && Card.GetCard(BattleData.Instance.Agent.SelectCards[0]).Element == Card.CardElement.light) { BattleData.Instance.Agent.SelectPlayers.Clear(); MessageSystem <MessageType> .Notify(MessageType.AgentSelectPlayer); } base.Process(msg, paras); break; default: base.Process(msg, paras); break; } }
public void JoinRoom(network.RoomListResponse.RoomInfo roomInfo, string password = null) { var proto = new network.EnterRoomRequest() { room_id = roomInfo.room_id }; if (!string.IsNullOrEmpty(password)) { proto.password = password; } GameManager.TCPInstance.Send(new Protobuf() { Proto = proto, ProtoID = ProtoNameIds.ENTERROOMREQUEST }); BattleData.Instance.Reset(); //其实这么写不太合适,但后端没有合适的协议 SelectRoom = roomInfo; //防止多次点击 MessageSystem <MessageType> .Notify(MessageType.EnterRoom); }
public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras) { switch (state) { case 1702: case 1703: OKAction = () => { sendActionMsg(BasicActionType.ACTION_MAGIC_SKILL, BattleData.Instance.MainPlayer.id, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards, state, BattleData.Instance.Agent.SelectArgs); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; CancelAction = () => { BattleData.Instance.Agent.FSM.BackState(UIStateMsg.Init); }; MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, string.Format("{0}: 请选择目标玩家以及异系卡牌", Skills[state].SkillName)); return; case 1704: OKAction = () => { sendReponseMsg(state, BattleData.Instance.MainPlayer.id, BattleData.Instance.Agent.SelectPlayers, BattleData.Instance.Agent.SelectCards); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; CancelAction = () => { sendReponseMsg(state, BattleData.Instance.MainPlayer.id); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; MessageSystem <Framework.Message.MessageType> .Notify(Framework.Message.MessageType.SendHint, string.Format("{0}: 请选择目标玩家以及同系卡牌", Skills[state].SkillName)); return; } base.UIStateChange(state, msg, paras); }
public override void UIStateChange(uint state, UIStateMsg msg, params object[] paras) { switch (state) { case 102: OKAction = () => { sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>() { 1 }); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; CancelAction = () => { sendReponseMsg(state, BattleData.Instance.MainPlayer.id, null, null, new List <uint>() { 0 }); BattleData.Instance.Agent.FSM.ChangeState <StateIdle>(UIStateMsg.Init, true); }; MessageSystem <MessageType> .Notify(MessageType.SendHint, string.Format("是否发动{0}", Skills[state].SkillName)); return; } base.UIStateChange(state, msg, paras); if (additionalState == 103) { //这代码真傻...应该做成list的 //但懒得改了 var t1 = OKAction; var t2 = ResignAction; OKAction = () => { t1(); additionalState = 0; }; ResignAction = () => { t2(); additionalState = 0; }; } }
void Awake() { players = GetComponent <BattleUIMobile>().PlayerStatus; btnSetting.onClick.AddListener(onBtnSettingClick); btnSpecial.onClick.AddListener(onBtnSpecialClick); btnOK.onClick.AddListener(onBtnOKClick); btnCancel.onClick.AddListener(onBtnCancelClick); btnResign.onClick.AddListener(onBtnResignClick); btnCovered.onClick.AddListener(OnCoveredClick); MessageSystem <MessageType> .Regist(MessageType.AgentUpdate, this); MessageSystem <MessageType> .Regist(MessageType.AgentHandChange, this); MessageSystem <MessageType> .Regist(MessageType.AgentStateChange, this); MessageSystem <MessageType> .Regist(MessageType.AgentSelectSkill, this); MessageSystem <MessageType> .Regist(MessageType.AgentUIStateChange, this); MessageSystem <MessageType> .Regist(MessageType.ShowNewArgsUI, this); MessageSystem <MessageType> .Regist(MessageType.CloseNewArgsUI, this); MessageSystem <MessageType> .Regist(MessageType.Lose, this); MessageSystem <MessageType> .Regist(MessageType.Win, this); MessageSystem <MessageType> .Regist(MessageType.AgentSelectCard, this); MessageSystem <MessageType> .Notify(MessageType.AgentUpdate); MessageSystem <MessageType> .Notify(MessageType.AgentHandChange); MessageSystem <MessageType> .Notify(MessageType.AgentUIStateChange); }