コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: ClientRoom.cs プロジェクト: Hengle/CsharpCode
        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);
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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);
 }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
    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.");
    }
コード例 #9
0
 public void BackToHall()
 {
     HallUtility.GameOver();
 }
コード例 #10
0
 private void SendChatMessage(BroadcastMessageData data)
 {
     HallUtility.SendChatMessage(data);
 }
コード例 #11
0
 public void GameOver()
 {
     HallUtility.GameOver();
 }
コード例 #12
0
 public void Handle(SimpleProto data)
 {
     HallUtility.GameOver();
 }
コード例 #13
0
ファイル: PingSystem.cs プロジェクト: yangfan111/CsharpCode
 private void YesCB()
 {
     ReconnectShow = false;
     HallUtility.GameOver();
 }
コード例 #14
0
    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
    }
コード例 #15
0
 public void CallByHall(ArrayList args)
 {
     HallUtility.MessageReceived(args);
 }
コード例 #16
0
 public void OnGameOver()
 {
     HallUtility.GameOver();
     _logger.InfoFormat("OnGameOver...");
 }