Esempio n. 1
0
    // Use this for initialization
    void Awake()
    {
        IsTestXiaoScreen = pcvr.IsTestXiaoScreen;
        pcvr.ResetBikeZuLiInfo();
        if (!IsServerPort)
        {
            int screenW = GetSystemMetrics(SM_CXSCREEN);
            if (screenW != ClientScreenW)
            {
                ClientScreenW = screenW;
            }

            if (!IsShowScreenInfo)
            {
                IsShowScreenInfo = true;
                Debug.Log("ClientScreenW " + ClientScreenW);
            }
        }

        ChangeMode.IsClickModeStart = false;
        CheckIsHavePlayerIp();
        //pcvr.ResetPlayerBianMaQiMaxVal();
        CountOpenServer++;
//		TimeClientFullScreen = Time.realtimeSinceStartup;
        ServerIpInfo = NetworkServerNet.ServerPortIP;
        if (!pcvr.bIsHardWare)
        {
            ServerIpInfo = NetworkServerNet.GetServerPortIp();
        }

//		if (IsServerPort && CountOpenServer == 1) {
//			if (ServerIpInfo == Network.player.ipAddress) {
//				Invoke("OpenGameClientPort", 15f);
//			}
//			else {
//				Application.Quit();
//				OpenGameClientPort();
//			}
//		}

        //if (IsServerPort && (!pcvr.bIsHardWare || pcvr.IsTestGetInput)) {
        //IsTestXiaoScreen = true; //test
        //}

        pcvr.CloseGameDongGan();
        QualitySettings.SetQualityLevel((int)QualityLevelGame.Good);
        if (RootObj == null)
        {
            gameObject.SetActive(false);
        }

        if (Application.loadedLevel > (int)GameLeve.Movie && GlobalData.GetInstance().IsFreeMode)
        {
            gameObject.SetActive(true);
        }

        Screen.showCursor = false;
        if (!IsRecordServerInfo)
        {
            IsRecordServerInfo = true;
            IsServer           = IsServerPort;
            if (IsServer)
            {
                pcvr.bIsHardWare = false;
            }

            if (!IsServer)
            {
                if (!IsTestXiaoScreen)
                {
                    if ((CountOpenServer == 1 &&
                         GlobalData.GetInstance().LinkModeState == 0 &&
                         ServerIpInfo == Network.player.ipAddress) ||
                        (CountOpenServer == 1 && GlobalData.GetInstance().LinkModeState == 1))
                    {
                        if (IsHavePlayerIp)
                        {
                            Screen.SetResolution(ClientScreenW, 768, false);
                            ChangeClientPortWindow();
                        }
                    }
                }
                else
                {
                    Screen.SetResolution(680, 384, false);
                }

                if (pcvr.bIsHardWare)
                {
                    pcvr.CloseFangXiangPanPower();
                }
            }
            else
            {
                //Screen.fullScreen = false;
                if (RootObj != null)
                {
                    RootObj.SetActive(false);
                }
                ChangeWindowPos();
                DelayCheckServerIP();
            }
        }
        SetPanelCtrl.GetInstance();

        GameTextType gameTextVal = GlobalData.GetGameTextMode();

        //GlobalData.GetInstance().IsFreeMode = true; //test
        if (GlobalData.GetInstance().IsFreeMode)
        {
            if (Application.loadedLevel > (int)GameLeve.Movie && GlobalData.GetInstance().IsFreeMode)
            {
                if (gameTextVal == GameTextType.Chinese)
                {
                    UiSpriteObj.spriteName = "mianFei";
                }
                else
                {
                    UiSpriteObj.spriteName = "mianFei_En";
                }
                gameObject.SetActive(true);
            }
            else
            {
                if (gameTextVal == GameTextType.Chinese)
                {
                    UiSpriteObj.spriteName = "Free";
                }
                else
                {
                    UiSpriteObj.spriteName = "Free_En";
                }
            }
            CointInfo.SetActive(false);

            if (Application.loadedLevel == (int)GameLeve.Movie)
            {
                StartBtObj.SetActive(true);
                pcvr.StartLightStateP1 = LedState.Shan;
            }
        }
        else
        {
            if (Application.loadedLevel > (int)GameLeve.Movie && GlobalData.GetInstance().IsFreeMode)
            {
                if (gameTextVal == GameTextType.Chinese)
                {
                    UiSpriteObj.spriteName = "qingTouBi";
                }
                else
                {
                    UiSpriteObj.spriteName = "qingTouBi_En";
                }
            }
            else
            {
                if (gameTextVal == GameTextType.Chinese)
                {
                    UiSpriteObj.spriteName = "PushCoin";
                }
                else
                {
                    UiSpriteObj.spriteName = "PushCoin_En";
                }
            }
            CointInfo.SetActive(true);
            StartBtObj.SetActive(false);
            pcvr.StartLightStateP1 = LedState.Mie;
            if (Application.loadedLevel != (int)GameLeve.Movie)
            {
                gameObject.SetActive(false);
            }
        }

        InputEventCtrl.GetInstance().ClickStartBtEvent += clickStartBtEvent;
    }