void OnExecute() { if (m_Category == null || m_Command == null) { Tooltip.Instance.ShowMessage("Please select command."); return; } CheatInfo cheat_info = CheatInfoManager.Instance.GetInfo(m_Category, m_Command); if (m_Param == null) { if (cheat_info.Params.Count > 0) { Tooltip.Instance.ShowMessage("Please select param."); return; } m_Param = ""; } if (BattleBase.Instance != null && m_Category != "Show") { Tooltip.Instance.ShowMessage("In the battle it can not be used."); return; } if (cheat_info.IsClient) { OnExecuteClient(); } else { C2G.Cheat packet = new C2G.Cheat(); packet.category = m_Category; packet.command = m_Command; packet.param = m_Param; Network.GameServer.JsonAsync <C2G.Cheat, C2G.CheatAck>(packet, OnExecuteAck); } }
void OnExecuteAck(C2G.Cheat packet, C2G.CheatAck ack) { if (string.IsNullOrEmpty(ack.error) == false) { Tooltip.Instance.ShowMessage(ack.error); return; } Network.PlayerInfo.SetPlayerData(ack.player_info); SaveDataManger.Instance.InitFromData(ack.detail_data); while (GameMain.Instance.BackMenu(true) == true) { ; } GameMain.Instance.GetCurrentMenu().UpdateMenu(); GameMain.Instance.UpdatePlayerInfo(); GameMain.Instance.CheckNotify(); CreatureManager.Instance.SetSort(); Tooltip.Instance.ShowMessage("Command Executed"); AddCategories(); }