void CheckServerPortIP() { if (Network.player.ipAddress == NetworkServerNet.ServerPortIP) { return; } XKCheckGameServerIP.CheckServerIP(); }
void OnGUI() { if (FreeModeCtrl.IsServer) { if (!pcvr.bIsHardWare) { return; } if (FreeModeCtrl.IsHavePlayerIp && Time.frameCount % 200 == 0) { if (Network.player != null) { PlayerIPInfo = Network.player.ipAddress; } } if (Time.realtimeSinceStartup - TimeLast < 20f) { if (PlayerIPInfo == NetworkServerNet.ServerPortIP) { return; } IsFixServerPortIP = true; string infoA = "The pc IP is " + PlayerIPInfo + ", ServerPortIP was wrong! Fixing IP..."; GUI.Box(new Rect(0, 0, Screen.width, Screen.height), infoA); return; } if (PlayerIPInfo == NetworkServerNet.ServerPortIP) { if (IsFixServerPortIP) { string infoA = "ServerPortIP is fixed, restart the game..."; GUI.Box(new Rect(0, 0, Screen.width, Screen.height), infoA); if (!IsRestartGame) { IsRestartGame = true; //XKCheckGameServerIP.CloseCmd(); XKCheckGameServerIP.RestartGame(); } } return; } string infoB = "Set ServerPortIp(192.168.0.2) is failed! The ip(192.168.0.2) has been used!"; GUI.Box(new Rect(0, 0, Screen.width, 30), infoB); string infoC = "Please restart the pc after change the pcIP(192.168.0.2) to otherIP!"; GUI.Box(new Rect(0, 30, Screen.width, 30), infoC); return; } }
void DelayCloseCmd() { XKCheckGameServerIP.CloseCmd(); }
public void OnClickRestartAppBt() { Application.Quit(); XKCheckGameServerIP.RunCmd("start ComTest.exe"); }
void OnGUI() { if (IsPlayMvLogo) { ShowGameMovieLogo(); if (Time.realtimeSinceStartup - TimeLogo >= 3f) { IsPlayMvLogo = false; TimeStartMV = Time.realtimeSinceStartup; TimeDelayHiddenMvLogo = Time.realtimeSinceStartup; Movie.Play(); AudioSourceObj.Play(); return; } return; } if (Time.realtimeSinceStartup - TimeDelayHiddenMvLogo < 0.2f) { ShowGameMovieLogo(); return; } if (renderer != null) { return; } //GUI.Box(new Rect(0f, 0f, 200f, 30f), "dtime "+Time.deltaTime.ToString("f3")); if (Network.peerType == NetworkPeerType.Server || GameTypeCtrl.AppTypeStatic == AppGameType.LianJiServer) { GUI.DrawTexture(new Rect(0f, 0f, Screen.width, Screen.height), Movie, ScaleMode.StretchToFill); TimeMovieVal = Time.realtimeSinceStartup - TimeStartMV; if (TimeMovieVal >= Movie.duration + 3f) { TimeLogo = Time.realtimeSinceStartup; IsPlayMvLogo = true; Movie.Stop(); AudioSourceObj.Stop(); TimeStartMV = Time.realtimeSinceStartup; CountMV++; } ShowGameMvLG(); if (!pcvr.bIsHardWare) { string mvInfo = "mvTime " + Movie.duration + ", CountMV " + CountMV + ", timeVal " + TimeMovieVal.ToString("f2"); GUI.Box(new Rect(0f, 0f, Screen.width * 0.5f, 30f), mvInfo); return; } if (Time.frameCount % 200 == 0) { PlayerIPInfo = Network.player.ipAddress; /*if (Network.player != null) { * PlayerIPInfo = Network.player.ipAddress; * }*/ } if (Time.realtimeSinceStartup - TimeLast < 20f) { if (PlayerIPInfo == NetworkServerNet.ServerPortIP) { return; } IsFixServerPortIP = true; string infoA = "The pc IP is " + PlayerIPInfo + ", ServerPortIP was wrong! Fixing IP..."; GUI.Box(new Rect(0, 0, Screen.width, Screen.height), infoA); return; } if (PlayerIPInfo == NetworkServerNet.ServerPortIP) { if (IsFixServerPortIP) { string infoA = "ServerPortIP is fixed, restart the game..."; GUI.Box(new Rect(0, 0, Screen.width, Screen.height), infoA); if (!IsRestartGame) { IsRestartGame = true; //XKCheckGameServerIP.CloseCmd(); XKCheckGameServerIP.RestartGame(); } } return; } string infoB = "Set ServerPortIp(192.168.0.2) is failed! The ip(192.168.0.2) has been used!"; GUI.Box(new Rect(0, 0, Screen.width, 30), infoB); string infoC = "Please restart the pc after change the pcIP(192.168.0.2) to otherIP!"; GUI.Box(new Rect(0, 30, Screen.width, 30), infoC); return; } if (IsStopMovie) { return; } CheckClientPortMovieInfo(); if (!IsThreeScreenGame) { GUI.DrawTexture(RectMv, Movie, ScaleMode.StretchToFill); } else { if (Screen.width > 1360) { float swTmp = (float)Screen.width / 3f; GUI.DrawTexture(new Rect(0f, 0f, swTmp, RectMv.height), Movie, ScaleMode.StretchToFill); GUI.DrawTexture(new Rect(swTmp, 0f, swTmp, RectMv.height), Movie, ScaleMode.StretchToFill); GUI.DrawTexture(new Rect(swTmp * 2f, 0f, swTmp, RectMv.height), Movie, ScaleMode.StretchToFill); } else { GUI.DrawTexture(RectMv, Movie, ScaleMode.StretchToFill); } // string testStr = "sw "+Screen.width+", sw/3 "+swTmp; // GUI.Box(new Rect(0f, 0f, 500f, 25f), testStr); } TimeVal += Time.deltaTime; int timeTmp = (int)TimeVal; if (!XKGlobalData.IsFreeMode) { if (timeTmp % 2 == 0) { if (XKGlobalData.CoinPlayerOne < XKGlobalData.GameNeedCoin) { GUI.DrawTexture(RectArray[0], TextureMv[0]); } else { GUI.DrawTexture(RectArray[2], TextureMv[1]); } if (XKGlobalData.CoinPlayerTwo < XKGlobalData.GameNeedCoin) { GUI.DrawTexture(RectArray[1], TextureMv[0]); } else { GUI.DrawTexture(RectArray[3], TextureMv[1]); } } else { if (XKGlobalData.CoinPlayerOne >= XKGlobalData.GameNeedCoin) { GUI.DrawTexture(RectArray[2], TextureMv[2]); } if (XKGlobalData.CoinPlayerTwo >= XKGlobalData.GameNeedCoin) { GUI.DrawTexture(RectArray[3], TextureMv[2]); } } } else { if (timeTmp % 2 == 0) { GUI.DrawTexture(RectArray[2], TextureMv[1]); GUI.DrawTexture(RectArray[3], TextureMv[1]); } else { GUI.DrawTexture(RectArray[2], TextureMv[2]); GUI.DrawTexture(RectArray[3], TextureMv[2]); } } if (Camera.main != null && IsThreeScreenGame) { Vector3 posTmp = Camera.main.WorldToScreenPoint(InsertCoinTr[0].position); float testPX = posTmp.x - (RectArray[0].width / 2f); float testPY = posTmp.y + (RectArray[0].height * 0.7f); testPY = Screen.height - testPY; RectArray[0].x = testPX; RectArray[0].y = testPY; posTmp = Camera.main.WorldToScreenPoint(InsertCoinTr[1].position); testPX = posTmp.x - (RectArray[1].width / 2f); RectArray[1].x = testPX; RectArray[1].y = testPY; posTmp = Camera.main.WorldToScreenPoint(StartBtTr[0].position); testPX = posTmp.x - (RectArray[2].width / 2f); testPY = posTmp.y + (RectArray[2].height * 0.7f); testPY = Screen.height - testPY; RectArray[2].x = testPX; RectArray[2].y = testPY; posTmp = Camera.main.WorldToScreenPoint(StartBtTr[1].position); testPX = posTmp.x - (RectArray[3].width / 2f); RectArray[3].x = testPX; RectArray[3].y = testPY; } TimeMovieVal = Time.realtimeSinceStartup - TimeStartMV; if (TimeMovieVal >= Movie.duration + 3f) { TimeLogo = Time.realtimeSinceStartup; IsPlayMvLogo = true; Movie.Stop(); AudioSourceObj.Stop(); TimeStartMV = Time.realtimeSinceStartup; CountMV++; } ShowGameMvLG(); if (!pcvr.bIsHardWare) { string mvInfo = "mvTime " + Movie.duration + ", CountMV " + CountMV + ", timeVal " + TimeMovieVal.ToString("f2"); GUI.Box(new Rect(0f, 0f, Screen.width * 0.5f, 30f), mvInfo); } XKGameFPSCtrl.DrawGameFPS(); }