void Handle_InputKey(int p, HpyInputKey k, bool down) { Players[p].OnKeyDown(k, down); if (down && k == HpyInputKey.BS_Confirm) { StartCoroutine("_Coro_PrepareEnterBackStage"); } else if (!down && k == HpyInputKey.BS_Confirm) { StopCoroutine("_Coro_PrepareEnterBackStage"); } if (down && k == HpyInputKey.OutBounty) { Players[p].OutBountyButtom(); } if (down && (k == HpyInputKey.BS_Up || k == HpyInputKey.BS_Down)) { if (!mIsEnteringBackstage) { if (mCurGameDataViewer == null) { mCurGameDataViewer = Instantiate(Prefab_GameDataViewer) as GameDataViewer; mCurGameDataViewer.IsOnlyViewNumber = k == HpyInputKey.BS_Up ? false : true; mCurGameDataViewer.transform.position = new Vector3(WorldDimension.xMin, WorldDimension.yMax, Defines.GlobleDepth_GameDataViewer); if (ScreenNumUsing > 1) { for (int i = 0; i != ScreenNumUsing - 1; ++i) { GameDataViewer gdv = Instantiate(Prefab_GameDataViewer) as GameDataViewer; gdv.transform.parent = mCurGameDataViewer.transform; gdv.transform.position = new Vector3(WorldDimension.xMin + Defines.WorldDimensionUnit.width * (i + 1) , WorldDimension.yMax, Defines.GlobleDepth_GameDataViewer); } } } else { Destroy(mCurGameDataViewer.gameObject); mCurGameDataViewer = null; } } } }
//void OnGUI() //{ // if (GUILayout.Button("fish")) // { // int nullFishNum = 0; // foreach (Fish fNull in FishInScene) // { // if (fNull == null) // ++nullFishNum; // } // Debug.Log("nullFishNum = " + nullFishNum); // } //} IEnumerator _Coro_EnterBackstage() { //停止玩家攻击 foreach (Player p in Players) { p.GunInst.Fireable = false; } //将进设置 GameObject[] goPrepareEnterBSs = new GameObject[ScreenNumUsing]; for(int i = 0; i != ScreenNumUsing; ++i) { goPrepareEnterBSs[i] = Instantiate(Prefab_GOPrepareEnterBS) as GameObject; goPrepareEnterBSs[i].transform.position = new Vector3(WorldDimension.x + WorldDimension.width * 0.5F * i, WorldDimension.y+WorldDimension.height, Defines.GlobleDepth_PrepareInBG); } yield return new WaitForSeconds(3F); //等待子弹结束 Player[] tmpPlayers = new Player[Players.Length]; for (int i = 0; i != Players.Length; ++i) tmpPlayers[i] = Players[i]; while (true) { float numPlayerHaventBullet = 0; for (int i = 0; i != tmpPlayers.Length; ++i) { if (tmpPlayers[i] != null && tmpPlayers[i].GunInst.NumBulletInWorld == 0) { tmpPlayers[i] = null; } if (tmpPlayers[i] == null) ++numPlayerHaventBullet; } if (numPlayerHaventBullet == tmpPlayers.Length) break; yield return 0; } //todo 可能在某些过程中 终止会出现bug,待测试 StopCoroutine("_Coro_MainProcess"); //停止出鱼 FishGenerator.StopFishGenerate(); Instantiate(Prefab_Backstage); foreach (GameObject go in goPrepareEnterBSs) { Destroy(go); } if (mCurGameDataViewer != null) { Destroy(mCurGameDataViewer.gameObject); mCurGameDataViewer = null; } mDisableAllPlayerKey = true; State_ = State.BackStage; }
//void OnGUI() //{ // if (GUILayout.Button("fish")) // { // int nullFishNum = 0; // foreach (Fish fNull in FishInScene) // { // if (fNull == null) // ++nullFishNum; // } // Debug.Log("nullFishNum = " + nullFishNum); // } //} IEnumerator _Coro_EnterBackstage() { //停止玩家攻击 foreach (Player p in Players) { p.GunInst.Fireable = false; } //将进设置 GameObject[] goPrepareEnterBSs = new GameObject[ScreenNumUsing]; for (int i = 0; i != ScreenNumUsing; ++i) { goPrepareEnterBSs[i] = Instantiate(Prefab_GOPrepareEnterBS) as GameObject; goPrepareEnterBSs[i].transform.position = new Vector3(WorldDimension.x + WorldDimension.width * 0.5F * i, WorldDimension.y + WorldDimension.height, Defines.GlobleDepth_PrepareInBG); } yield return(new WaitForSeconds(3F)); //等待子弹结束 Player[] tmpPlayers = new Player[Players.Length]; for (int i = 0; i != Players.Length; ++i) { tmpPlayers[i] = Players[i]; } while (true) { float numPlayerHaventBullet = 0; for (int i = 0; i != tmpPlayers.Length; ++i) { if (tmpPlayers[i] != null && tmpPlayers[i].GunInst.NumBulletInWorld == 0) { tmpPlayers[i] = null; } if (tmpPlayers[i] == null) { ++numPlayerHaventBullet; } } if (numPlayerHaventBullet == tmpPlayers.Length) { break; } yield return(0); } //todo 可能在某些过程中 终止会出现bug,待测试 StopCoroutine("_Coro_MainProcess"); //停止出鱼 FishGenerator.StopFishGenerate(); Instantiate(Prefab_Backstage); foreach (GameObject go in goPrepareEnterBSs) { Destroy(go); } if (mCurGameDataViewer != null) { Destroy(mCurGameDataViewer.gameObject); mCurGameDataViewer = null; } mDisableAllPlayerKey = true; State_ = State.BackStage; }