コード例 #1
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_ENTER_SCENE packet = (GC_ENTER_SCENE)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }

            //enter your logic
            //EnterScene为玩家登陆数据的一部分,另外一部分在CreatePlayer消息包中发送
            //记录登录场景的位置
            float fEnterPosX = ((float)packet.PosX) / 100;
            float fEnterPosZ = ((float)packet.PosZ) / 100;

            GameManager.gameManager.PlayerDataPool.EnterSceneCache.EnterScenePos      = new UnityEngine.Vector3(fEnterPosX, 0, fEnterPosZ);
            GameManager.gameManager.PlayerDataPool.EnterSceneCache.EnterSceneServerID = packet.Mainplayerserverid;
            GameManager.gameManager.PlayerDataPool.EnterSceneCache.EnterSceneSceneID  = packet.Sceneclass;
            SceneData.SceneInst = packet.Sceneinst;

            //进入切场景流程
            NetWorkLogic.GetMe().CanProcessPacket = false;
            GameEvent _event = new GameEvent(Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_CHANGESCENE);

            _event.AddIntParam(packet.Sceneclass);
            Singleton <EventSystem> .GetInstance().PushEvent(_event);

            GameManager.gameManager.ActiveScene.StartTime = Time.realtimeSinceStartup;
            GameManager.gameManager.ActiveScene.ExistTime = packet.ExistTime / 1000;
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
コード例 #2
0
 void DoReconnect()
 {
     m_IsAskConnecting = false;
     m_bAskConnecting  = false;
     NetWorkLogic.SetConcnectDelegate(Ret_Reconnect);
     NetWorkLogic.GetMe().ReConnectToServer();
 }
コード例 #3
0
 //=================================
 void OnCloseClick()
 {
     // 未选择角色(直接退出创建流程)
     //if (m_ChooseIndex == 0)
     {
         if (LoginData.loginRoleList.Count > 0)
         {
             LoginUILogic.Instance().EnterChooseRole();
             //HideProfeesion();
         }
         else
         {
             //NetManager.SendUserLogout();
             NetWorkLogic.GetMe().DisconnectServer();
             LoginUILogic.Instance().EnterServerChoose();
         }
     }
     // 已选择角色,退到展示界面(未做)
     //else
     //{
     //ReturnChooseChar();
     //ShowProfessionDelay(m_delaySelectBack);
     //HideProDetail();
     //}
 }
コード例 #4
0
 public void backToServer()
 {
     m_chooseIndex = 0;
     NetWorkLogic.GetMe().DisconnectServer();
     LoginUILogic.Instance().EnterServerChoose();
     //DestroyPartnerFakeObj ();
     LoginUILogic.Instance().DestroyRoleModeObj();
 }
コード例 #5
0
ファイル: QueueWindow.cs プロジェクト: kimch2/PackageClient
 void OnLeaveQueueClick()
 {
     if (ServerChooseController.Instance() != null)
     {
         ServerChooseController.Instance().SwitchWindow((int)ServerChooseController.Window.ServerList);
         UIManager.CloseUI(UIInfo.QueueWindow);
         NetWorkLogic.GetMe().DisconnectServer();
     }
 }
コード例 #6
0
 /// <summary>
 /// 连接服务器
 /// </summary>
 /// <param name="_ip"></param>
 /// <param name="_port"></param>
 /// <param name="delConnect"></param>
 public void ConnectToServer(string _ip, int _port, Action <bool, string> delConnect)
 {
     m_connectIP   = _ip;
     m_connectPort = _port;
     m_delConnect  = delConnect;
     LogModule.DebugLog("Connect to Server... ip:" + m_connectIP + " port :" + m_connectPort.ToString());
     NetWorkLogic.SetConcnectDelegate(m_delConnect);
     NetWorkLogic.GetMe().ConnectToServer(m_connectIP, m_connectPort, 500);
 }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     LoadUIPrefab();
     if (NetWorkLogic.GetMe().GetConnectStautus() == NetWorkLogic.ConnectStatus.DISCONNECTED)
     {
         NetManager.Instance().ConnectLost();
     }
     PVPData.CheckAutoShowChallengeUI();
     PVPData.CheckAutoShowPowerUpUI();
 }
コード例 #8
0
    public void OnCYUserLogin(string param)
    {
        LogModule.DebugLog("----OnCYUserLogin:"******"data"];
        JsonData dataObj         = JsonMapper.ToObject(data);
        string   strValidateInfo = (string)dataObj["validateInfo"];
#else
        //param = "{\"uid\":\"514001613706505\",\"token\":\"9f38e276d3d758b5\",\"deviceid\":\"10001\",\"userip\":\"10001\",\"type\":\"c\",\"appid\":\"101005256\"},4001,10001"
        //LogModule.DebugLog(param);
        string keyValidateInfo = "\"validateInfo\":";

        int    validateInfoPos = param.IndexOf(keyValidateInfo) + keyValidateInfo.Length + 1;
        string strValidateInfo = param.Substring(validateInfoPos, param.IndexOf("\"", validateInfoPos) - validateInfoPos);

        //int opCodePos = param.LastIndexOf(",") + 1;
        //string opCode = param.Substring(opCodePos);

        //int channelPos = param.LastIndexOf("},") + 2;
        //string stringChannel = param.Substring(channelPos, opCodePos - 1 - channelPos);
#endif
        LoginData.accountData.SetCYData(strValidateInfo);
        if (PlatformHelper.GetChannelType() == PlatformHelper.ChannelType.IOS_XY)
        {
            m_bReceiveNewLoginData = true;
        }

        if (ServerChooseController.Instance() == null)
        {
            // 只允许在登陆界面登陆
            return;
        }

#if UNITY_WP8
        NetWorkLogic.SetConcnectDelegate(WpLoginReconnect);
        NetWorkLogic.GetMe().ReConnectToServer();
#else
        SendLoginInfo();
#endif
    }
コード例 #9
0
    void OnGUI()
    {
        if (GUILayout.Button("door", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
        {
            m_bUseOtherFun = !m_bUseOtherFun;
        }

        if (m_bUseOtherFun)
        {
            if (m_bOpenHideUI && GUILayout.Button("HideUI", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
            {
                if (null == uiRoot)
                {
                    uiRoot = GameObject.Find("UI Root");
                }
                uiRoot.SetActive(!uiRoot.activeSelf);
            }

            if (GUILayout.Button("DisConnect", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
            {
                NetWorkLogic.GetMe().DisconnectServer();
            }

            if (m_bOpenPlayerSound && GUILayout.Button("PlayerSound", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
            {
                bool bEnable = SoundManager.m_EnableBGM;
                bEnable = !bEnable;
                SoundManager.m_EnableBGM = bEnable;
                SoundManager.m_EnableSFX = bEnable;
            }

            if (LoginData.m_bEnableTestAccount)
            {
                if (GUILayout.Button("Disable TestAccount", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
                {
                    LoginData.m_bEnableTestAccount = false;
                }

                LoginData.m_strTestAccount = GUI.TextField(new Rect(Screen.width - 200, 0, 200, _heightValue), LoginData.m_strTestAccount, 15);
            }
            else
            {
                if (GUILayout.Button("Enable TestAccount", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
                {
                    LoginData.m_bEnableTestAccount = true;
                }
            }

            if (m_bOpenNameHeight)
            {
                m_strSetNameHeight = GUI.TextField(new Rect(Screen.width - 200, _heightValue, 200, _heightValue), m_strSetNameHeight, 15);
                if (GUILayout.Button("ChangeNameHeight", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
                {
                    if (Singleton <ObjManager> .Instance.MainPlayer)
                    {
                        float fNewHeight;
                        bool  bResult = float.TryParse(m_strSetNameHeight, out fNewHeight);
                        if (bResult)
                        {
                            Obj_Character target = Singleton <ObjManager> .Instance.MainPlayer.SelectTarget;
                            if (null != target)
                            {
                                BillBoard billboard = target.HeadInfoBoard.GetComponent <BillBoard>();
                                if (billboard != null)
                                {
                                    billboard.fDeltaHeight = fNewHeight;
                                }
                            }

                            //m_IsSetNameHeight = false;
                        }
                    }
                }
            }

            if (m_bOpenUnload && GUILayout.Button("Unload unuse", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
            {
                //BundleManager.DoUnloadUnuseBundle();
            }

#if UNITY_EDITOR
            if (GUILayout.Button("scene", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
            {
                Cutscene.CutsceneManager.Instance.PlayCutscene(999);
            }
#endif

            if (GUILayout.Button("Debug", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
            {
                UnityGuiConsole.Instance.Visible = !UnityGuiConsole.Instance.Visible;
            }
        }
    }
コード例 #10
0
 public void OnLoginTimeOut()
 {
     NetWorkLogic.GetMe().DisconnectServer();
     MessageBoxLogic.OpenOKBox(1005, 1000);
 }
コード例 #11
0
        void Awake()
        {
            //设置当前场景
            if (null == GameManager.gameManager)
            {
                ResourceManager.InstantiateResource("Prefab/Logic/GameManager", "GameManagerObject");
                if (null != GameManager.gameManager)
                {
                    GameManager.gameManager.Init();
                }
                else
                {
                    LogModule.ErrorLog("Create GameManagerInstance failed");
                }
            }

            if (null == PlatformListener.Instance())
            {
                ResourceManager.InstantiateResource("Prefab/Logic/PlatformListener", "PlatformListener");
            }
            //将当前场景SceneLogic放入GameManager暂存
            GameManager.gameManager.SceneLogic = this;

            ResourceManager.InstantiateResource("Prefab/Logic/FingerGestures", "FingerGestures");

            // 将Debug工具挂入场景,如发布正式版,注释掉此行代码
            DebugHelper.CreateDebugHelper();
            CreateAndroidHelper();             //```````````````````
            Singleton <ObjManager> .GetInstance().OnEnterScene();

            // 动态加载场景无法加载SHADER问题
#if UNITY_EDITOR
            GameObject SceneObj = GameObject.Find("Scene");
            if (null != SceneObj && SceneObj.GetComponent <ShaderFix>() == null)
            {
                SceneObj.AddComponent <ShaderFix>();
            }

            TeleportPoint[] Teleports = GameObject.FindObjectsOfType <TeleportPoint>();
            foreach (TeleportPoint curTeleport in Teleports)
            {
                if (curTeleport.gameObject.GetComponent <ShaderFix>() == null)
                {
                    curTeleport.gameObject.AddComponent <ShaderFix>();
                }
            }
#endif
            GameManager.gameManager.ActiveScene.Init();

            //为了防止低端机型在场景切换完成和人物创建完成之间会照到空白的地方,这里先调整一下摄像机的位置
            if (null != Camera.main)
            {
                Vector3 camInitPos = GameManager.gameManager.PlayerDataPool.EnterSceneCache.EnterScenePos;
                camInitPos    = ActiveScene.GetTerrainPosition(camInitPos);
                camInitPos.y += 8.0f;
                Camera.main.transform.position = camInitPos;
            }

            //初始化场景通路图
            if (null != GameManager.gameManager.AutoSearch)
            {
                GameManager.gameManager.AutoSearch.InitMapConnectPath();
            }

            //设置是否可处理消息包
            NetWorkLogic.GetMe().CanProcessPacket = true;

            // 广播进入场景消息
            if (GameManager.gameManager.RunningScene != (int)GameDefine_Globe.SCENE_DEFINE.SCENE_LOADINGSCENE)
            {
                Messenger.Broadcast(MessengerConst.OnEnterSceneFinish);
            }
        }
コード例 #12
0
 public void SendPacket()
 {
     NetWorkLogic.GetMe().SendPacket(this);
 }
コード例 #13
0
 void Update()
 {
     NetWorkLogic.GetMe().Update();
 }
コード例 #14
0
 private static void OnReturnServerChoose()
 {
     NetWorkLogic.GetMe().DisconnectServer();
     LoginUILogic.Instance().EnterServerChoose();
 }
コード例 #15
0
 private void DoConnectToServer()
 {
     LogModule.DebugLog("Connect to Server... ip:" + m_connectIP + " port :" + m_connectPort.ToString());
     NetWorkLogic.SetConcnectDelegate(m_delConnect);
     NetWorkLogic.GetMe().ConnectToServer(m_connectIP, m_connectPort, 500);
 }
コード例 #16
0
 public void OnUpdate()
 {
     NetWorkLogic.GetMe().Update();
 }
コード例 #17
0
 public void DisconnectServer()
 {
     NetWorkLogic.GetMe().DisconnectServer();
 }