void OnBackHallETClick(BaseEventData data) { if (menuUiAdapter != null) { _viewModel.rootActiveSelf = false; menuUiAdapter.UnRegisterKeyReceive(keyReceive); menuUiAdapter.UnRegisterPointerReceive(pointerReceiver); string title = ""; bool isOverGame = menuUiAdapter.PlayStaue == (int)EPlayerLifeState.Dead || menuUiAdapter.WarVictory; title = isOverGame ? I2.Loc.ScriptLocalization.client_common.word13 : I2.Loc.ScriptLocalization.client_common.word14; string yesText = I2.Loc.ScriptLocalization.client_common.word15; Action yesCB = () => { HallUtility.GameOver(); }; Action noCB = () => { _viewModel.rootActiveSelf = true; menuUiAdapter.RegisterKeyReceive(keyReceive); menuUiAdapter.RegisterPointerReceive(pointerReceiver); menuUiAdapter.SetCrossVisible(false); }; string noText = I2.Loc.ScriptLocalization.client_common.word16; menuUiAdapter.ShowNoticeWindow(title, yesCB, noCB, yesText, noText); } }
private bool CheckPersonalOnlineStatusAndSendPrivateChat() { bool res = false; string name = string.Empty; string message = string.Empty; ParseInputForPrivateChat(out name, out message); if (!string.IsNullOrEmpty(name)) { res = true; } else if (_curChannel == ChatChannel.PrivateChat && !string.IsNullOrEmpty(_curTargetPlayerName)) { res = true; name = _curTargetPlayerName; message = inputField.text; } else { return(false); } if (!toBeSendDict.ContainsKey(name)) { toBeSendDict.Add(name, new Queue <string>()); } toBeSendDict[name].Enqueue(message); //inputField.text = string.Empty; HallUtility.SendCheckPersonalOnlineStatus(name); return(res); }
public void Update() { try { if (_isDisposed) { return; } if (_isDisconnected) { HallUtility.GameOver(); } else { SingletonManager.Get <DurationHelp>().ProfileStart(CustomProfilerStep.Room); var sessionObjects = _contexts.session.clientSessionObjects; sessionObjects.MessageDispatcher.DriveDispatch(); StepExecuteManager.Instance.Update(); _clientSessionStateMachine.Update(); } } finally { SingletonManager.Get <DurationHelp>().ProfileEnd(CustomProfilerStep.Room); } }
private void SendPrivateChat(long id) { var str = toBeSendDict[TargetIdDict[id]].Dequeue(); var data = GetNewBroadcastMessageData(str); data.ChatType = (int)ChannelToChatType(ChatChannel.PrivateChat); data.TargetId = id; HallUtility.SendChatMessage(data); }
void RegisterClientCallback() { HallUtility.RegisterCallback(HallUtility.Method_StartGame, (data) => StartGame(data as ArrayList)); HallUtility.RegisterCallback(HallUtility.Method_DisposeClient, (data) => DisposeClient()); HallUtility.RegisterCallback(HallUtility.Method_SendChatMessageToGamne, SendChatMessageToGame); HallUtility.RegisterCallback(HallUtility.Method_SendCheckPersonalOnlineStatusToGame, SendCheckPersonalOnlineStatusToGame); }
void OnSettingETClick(BaseEventData data) { _viewModel.rootActiveSelf = false; UnRegisterReceive(); Action <bool> hideCallback = (active) => { menuUiAdapter.SetInputManagerEnable(true); ShowMenu(false); }; Action <bool> showCallback = (active) => { menuUiAdapter.SetInputManagerEnable(false); menuUiAdapter.SetCrossVisible(false); //关系准心 }; HallUtility.ShowSettingWindow(showCallback); HallUtility.SetSettingWindowNovisCallBack(hideCallback); }
private void SendMessageData() { string str = inputField.text; if (string.IsNullOrEmpty(str)) { return; } var targetStrWithOutBlack = str.Trim(); if (string.IsNullOrEmpty(targetStrWithOutBlack)) { inputField.text = string.Empty; return; } if (CheckPersonalOnlineStatusAndSendPrivateChat())//私聊状态 { return; } var data = GetNewBroadcastMessageData(str); data.ChatType = (int)ChannelToChatType(_curChannel); if (_curChannel == ChatChannel.Near) { HallUtility.SendNearChatMessage(GetNearData(data, _chatState.NearPlayerInfo)); } else if (_curChannel == ChatChannel.Camp) { HallUtility.SendCampChatMessage(GetCampData(data, _chatState.CampPlayerInfo)); } else if (_curChannel == ChatChannel.PrivateChat) //不合法的私聊状态 { AddMessageForUnablePrivateChat(); } else { SendChatMessage(data); } }
public void OnDestroy() { Debug.Log("OnDestroy"); _logger.InfoFormat("Start Destroy..."); _isDestroy = true; MyHttpServer.Stop(); if (_loginClient != null) { _loginClient.Dispose(); } _logger.InfoFormat("Login Client Disposed."); HallUtility.ClearAciton(); _clientRoom.Dispose(); DefaultGo.Clear(GameRunningStage.BattleClient); SingletonManager.Dispose(); #if UNITY_SOURCE_MODIFIED && !UNITY_EDITOR UnityProfiler.DisableProfiler(); #endif _logger.InfoFormat("Client Destroy Completed."); }
public void BackToHall() { HallUtility.GameOver(); }
private void SendChatMessage(BroadcastMessageData data) { HallUtility.SendChatMessage(data); }
public void GameOver() { HallUtility.GameOver(); }
public void Handle(SimpleProto data) { HallUtility.GameOver(); }
private void YesCB() { ReconnectShow = false; HallUtility.GameOver(); }
IEnumerator Start() { Log4ConfigManager.InitLog4net(); Application.logMessageReceived += UnityLogCapturer.ApplicationOnLogMessageReceived; #if !UNITY_EDITOR BootArg = new string[0]; #endif if (null == BootArg) { BootArg = new string[0]; } var bootCmd = CmdParser.ParseCommandLine(BootArg.Length != 0 ? BootArg : System.Environment.GetCommandLineArgs()); QualitySettings.shadowDistance = 120; PlayerPrefs.DeleteKey("unity_server_mode"); _isDestroy = false; var hallController = GetHallController(); if (hallController == null) { #if UNITY_EDITOR SharedConfig.IsOffline = Offline; SharedConfig.IsRobot = IsRobot; SharedConfig.MutilThread = !DisableMutilThread; SharedConfig.DisableDoor = DisableDoor; #endif SharedConfig.InitConfigBootArgs(bootCmd); } else { SharedConfig.IsOffline = false; } SharedConfig.IsServer = false; // 删除是否服务器数据 _logger = new LoggerAdapter(typeof(ClientGameController)); RegisterClientCallback(); InitPhysicsSimulation(); InitCamera(); ComponentAllocateManager.Instance.Init(); if (hallController == null) { _assetLoader = new AssetPool(this); yield return(StartCoroutine(_assetLoader.Init(SingletonManager.Get <ClientFileSystemConfigManager>().BootConfig.Resource, SharedConfig.IsServer))); DoStart(); } else { _assetLoader = AssetPool.Instance; HallUtility.GetGameClientInfo(); _logger.InfoFormat("GetGameClientInfo..."); } MyHttpServer.Start(SingletonManager.Get <ClientFileSystemConfigManager>().BootConfig.HttpPort, _clientRoom); #if UNITY_SOURCE_MODIFIED && !UNITY_EDITOR if (!SharedConfig.InSamplingMode && !SharedConfig.InLegacySampleingMode) { UnityProfiler.EnableProfiler(true); } #endif }
public void CallByHall(ArrayList args) { HallUtility.MessageReceived(args); }
public void OnGameOver() { HallUtility.GameOver(); _logger.InfoFormat("OnGameOver..."); }