public void OnClickMoveRight() { int SenceNum = Application.loadedLevel - pcvr.chenNum; switch (SenceNum) { case 1: //投币界面 OnClickRightBtInToubi(); break; case 2: //游戏1界面 OnClickMoveRightBtInGame(); break; case 3: //设置界面 SetPanel.GetInstance().OnMoveRightBt(); break; case 4: //游戏2界面 OnClickMoveRightBtInGame(); break; default: break; } }
void Start() { set_panel = GameObject.Find("Canvas/GUI Panel/SetPanel").GetComponent <SetPanel>(); card_game_object = GameObject.Find("CardGameObject"); p1_deck = GameObject.Find("Player1Deck"); p2_deck = GameObject.Find("Player2Deck"); p3_deck = GameObject.Find("Player3Deck"); p4_deck = GameObject.Find("Player4Deck"); point = GameObject.Find("Point"); InitDeck(); RandCard(); SortCardByValue(p1); SortCardByValue(p2); SortCardByValue(p3); SortCardByValue(p4); CheckCardOnHand(p1); InstantiateCard(p1, p1_deck); InstantiateCard(p2, p2_deck, 0.4f); InstantiateCard(p3, p3_deck); InstantiateCard(p4, p4_deck, 0.4f); // vertical orientation arrange p2_deck.transform.Rotate(0.0f, 0.0f, 90.0f); p4_deck.transform.Rotate(0.0f, 0.0f, -90.0f); // init first player turn turn_state = (int)TurnState.P1; player_turn = p1; }
public void OnMoveShootCursor(float x, float y) { if (PlayerController.GetInstance() != null) { PlayerController.GetInstance().OnMoveShootCursor(x, y); } if (SetPanel.GetInstance() != null) { SetPanel.GetInstance().OnMoveShootCursor(x, y); } }
//全局响应投币按键消息 public void OnClickInsertBt() { int SenceNum = Application.loadedLevel - pcvr.chenNum; switch (SenceNum) { case 0: //循环动画 { OnClickInsertBtInMoview(); } break; case 1: //投币界面 { OnClickInsertBtInToubi(); } break; case 2: //游戏界面 { OnClickInsertBtInGame(); } break; case 3: //设置界面 { SetPanel.GetInstance().OnClickInsertBt(); } break; case 4: //游戏界面 { OnClickInsertBtInGame(); } break; } }
public void OpenSetPanel() { SetPanel = (SetPanel)UIManager.Instance.PushPanel(UIPanelType.Set); }
void OnClickStartButtonP2InPanel() { SetPanel.GetInstance().OnClickStartButtonP2InPanel(); }
void OnClickMoveBtSetPanel() //设置界面响应移动按键 { SetPanel.GetInstance().OnClickMoveBt(); }
void OnClickSetBtInSetPanel() //设置界面响应设置按键 { SetPanel.GetInstance().OnClickSelectBt(); }
public void keyProcess(uint [] bufferKey) { if (!MyCOMDevice.IsFindDeviceDt) { return; } if (bufferKey[0] != ReadHead_1 || bufferKey[1] != ReadHead_2) { return; } if (openPCVRFlag != 1) { return; } //41 - 42 - 19 - 20 gun - post gunX = (int)(((bufferKey[2] & 0x0f) << 8) + bufferKey[3]); //gun x - high and low gunY = (int)(((bufferKey[4] & 0x0f) << 8) + bufferKey[5]); //gun y - high and low gunXT = gunX; gunYT = gunY; if (gunXT > posXMax && gunXT > posXMin) { if (posXMax > posXMin) { gunXT = posXMax; } else { gunXT = posXMin; } } else if (gunXT < posXMax && gunXT < posXMin) { if (posXMax > posXMin) { gunXT = posXMin; } else { gunXT = posXMax; } } if (posXMin == posXMax) { posXMax = posXMin + 1; } if (posYMin == posYMax) { posYMax = posYMin + 1; } if (gunYT > posYMax && gunYT > posYMin) { if (posYMax > posYMin) { gunYT = posYMax; } else { gunYT = posYMin; } } else if (gunYT < posYMax && gunYT < posYMin) { if (posYMax > posYMin) { gunYT = posYMin; } else { gunYT = posYMax; } } if (CtrlForHardWare.GetInstance() != null) { CtrlForHardWare.GetInstance().OnMoveShootCursor((float)Mathf.Abs(gunXT - posXMin) / Mathf.Abs(posXMax - posXMin), (float)Mathf.Abs(gunYT - posYMin) / Mathf.Abs(posYMax - posYMin)); } CoinCurPcvr = bufferKey[6]; if (IsSubPlayerCoin) { IsSubPlayerCoin = false; } else { if (CoinCurPcvr > 0) { mOldCoinNum += CoinCurPcvr; CoinCurGame = (int)mOldCoinNum; SubPcvrCoin((int)CoinCurPcvr); if (CtrlForHardWare.GetInstance() != null) { CtrlForHardWare.GetInstance().OnClickInsertBt(); } } } //3 - setPanel selectBt if (!bSetEnterKeyDown && (bufferKey[9] & 0x02) == 0x02) { bSetEnterKeyDown = true; } else if (bSetEnterKeyDown && (bufferKey[9] & 0x02) == 0x00) { bSetEnterKeyDown = false; if (CtrlForHardWare.GetInstance() != null) { CtrlForHardWare.GetInstance().OnClickSetBt(); } } //4 - setPanel moveBt if (!bSetMoveKeyDown && (bufferKey[9] & 0x04) == 0x04) { bSetMoveKeyDown = true; } else if (bSetMoveKeyDown && (bufferKey[9] & 0x04) == 0x00) { bSetMoveKeyDown = false; if (CtrlForHardWare.GetInstance() != null) { CtrlForHardWare.GetInstance().OnClickMoveBt(); } } //8-7 - huizhong chuanganqi if (!huizhongCGQ && (bufferKey[8] & 0x80) == 0x80) { huizhongCGQ = true; } else if (huizhongCGQ && (bufferKey[8] & 0x80) == 0x00) { huizhongCGQ = false; //add infor here -- lxy if (SetPanel.GetInstance()) { SetPanel.GetInstance().OnClickOtherButtonInPanel(); } } //8 - stop urgent if (!stopUrgentY && (bufferKey[9] & 0x01) == 0x01) { stopUrgentY = true; if (!stopUrgent && (!p1AnquandaiOpen || (PlayerController.IsKaiqiang && !p2AnquandaiOpen))) { Debug.Log("stop urgent do nothing!"); } else { stopUrgent = !stopUrgent; if (stopUrgent && UIController.GetInstance() != null) { UIController.GetInstance().CloseDonggan(); UIController.GetInstance().openLeAnquandaiP1(false); UIController.GetInstance().openLeAnquandaiP2(false); } else if (!stopUrgent && UIController.GetInstance() != null) { if (!p1AnquandaiOpen) { UIController.GetInstance().closeLeAnquandaiP1(); } if (PlayerController.IsKaiqiang && !p2AnquandaiOpen) { UIController.GetInstance().closeLeAnquandaiP2(); } } if (!stopUrgent && UIController.GetInstance() != null) { UIController.GetInstance().OpenDonggan(); } } } else if (stopUrgentY && (bufferKey[9] & 0x01) == 0x00) { stopUrgentY = false; if (SetPanel.GetInstance()) { SetPanel.GetInstance().OnClickOtherButtonInPanel(); } } //ffffffffffffffffff lxy change if (!p1AnquandaiPress && (bufferKey[8] & 0x01) == 0x01) { p1AnquandaiPress = true; p1AnquandaiOpen = true; if (Loading.GetInstance()) { Loading.GetInstance().openLeAnquandaiP1(); } if (!stopUrgent && UIController.GetInstance()) { if (!PlayerController.IsKaiqiang || (PlayerController.IsKaiqiang && p2AnquandaiOpen)) { UIController.GetInstance().openLeAnquandaiP1(true); } else { UIController.GetInstance().openLeAnquandaiP1(false); } } } else if (p1AnquandaiPress && (bufferKey[8] & 0x01) == 0x00) { p1AnquandaiPress = false; p1AnquandaiOpen = false; if (!openAanquandai) { p1AnquandaiOpen = true; } if (SetPanel.GetInstance()) { SetPanel.GetInstance().OnClickOtherButtonInPanel(); } } if (!stopUrgent && !p1AnquandaiOpen && UIController.GetInstance()) { UIController.GetInstance().closeLeAnquandaiP1(); } //fffffffffffffffffffffff lxy change if (!p2AnquandaiPress && (bufferKey[8] & 0x02) == 0x02) { p2AnquandaiPress = true; p2AnquandaiOpen = true; if (Loading.GetInstance()) { Loading.GetInstance().openLeAnquandaiP2(); } if (!stopUrgent && UIController.GetInstance()) { if (p1AnquandaiOpen) { UIController.GetInstance().openLeAnquandaiP2(true); } else { UIController.GetInstance().openLeAnquandaiP2(false); } } } else if (p2AnquandaiPress && (bufferKey[8] & 0x02) == 0x00) { p2AnquandaiPress = false; p2AnquandaiOpen = false; if (!openAanquandai) { p2AnquandaiOpen = true; } if (SetPanel.GetInstance()) { SetPanel.GetInstance().OnClickOtherButtonInPanel(); } } if (!stopUrgent && !p2AnquandaiOpen && UIController.GetInstance() && PlayerController.IsKaiqiang) { UIController.GetInstance().closeLeAnquandaiP2(); } //30 - check congJi move state ?????????????? lxy ---- bian pin qi tingzhi biaoji if ((bufferKey[9] & 0x08) == 0x08) { //moving } else if ((bufferKey[9] & 0x08) == 0x00) { //stop moving } //37 - turn left if (!turnLeftPressDown && (bufferKey[8] & 0x04) == 0x00) { turnLeftPressDown = true; if (CtrlForHardWare.GetInstance() != null) { CtrlForHardWare.GetInstance().OnClickMoveLeft(); } } else if (turnLeftPressDown && (bufferKey[8] & 0x04) == 0x00) { if ((Application.loadedLevel - chenNum == 2 || Application.loadedLevel - chenNum == 4) && !bZhendong) { qinangStateRight = 11; } } else if (turnLeftPressDown && (bufferKey[8] & 0x04) == 0x04) { turnLeftPressDown = false; qinangStateRight = 12; } //38 - turn right if (!turnRightPressDown && (bufferKey[8] & 0x08) == 0x00) { turnRightPressDown = true; if (CtrlForHardWare.GetInstance() != null) { CtrlForHardWare.GetInstance().OnClickMoveRight(); } if ((Application.loadedLevel - chenNum == 2 || Application.loadedLevel - chenNum == 4) && !bZhendong) { qinangStateLeft = 11; } } else if (turnRightPressDown && (bufferKey[8] & 0x08) == 0x00) { if ((Application.loadedLevel - chenNum == 2 || Application.loadedLevel - chenNum == 4) && !bZhendong) { qinangStateLeft = 11; } } else if (turnRightPressDown && (bufferKey[8] & 0x08) == 0x08) { turnRightPressDown = false; qinangStateLeft = 12; } //shache if (turnLeftPressDown && turnRightPressDown) { //shache here m_IsShache = true; if (ZhujuemaController.GetInstance() != null && PlayerController.GetInstance() != null) { ZhujuemaController.GetInstance().OnClickShacheBt(); PlayerController.GetInstance().OnClickShacheBt(); } if (CtrlForHardWare.GetInstance() != null) { CtrlForHardWare.GetInstance().OnClickShacheBt(); } } else { m_IsShache = false; } if (!bPlayerStartKeyDownP1 && (bufferKey[8] & 0x10) == 0x10) { bPlayerStartKeyDownP1 = true; } else if (bPlayerStartKeyDownP1 && (bufferKey[8] & 0x10) == 0x00) { bPlayerStartKeyDownP1 = false; if (CtrlForHardWare.GetInstance() != null) { CtrlForHardWare.GetInstance().OnClickBeginBt1P(); } } //40 - shooting if ((bufferKey[8] & 0x20) == 0x20) { if (PlayerShoot.GetInstance() != null) { PlayerShoot.GetInstance().OnClickFire(); } if (SetPanel.GetInstance() != null && !bPlayerOnRocket) { bPlayerOnRocket = true; SetPanel.GetInstance().OnClickFireBt(); } //2p start button chang ffffffffffffffffffffffffffffffffffffff lxy if (!bPlayerStartKeyDownP2) { bPlayerStartKeyDownP2 = true; } } else if ((bufferKey[8] & 0x20) == 0x00) { if (PlayerShoot.GetInstance() != null) { PlayerShoot.GetInstance().m_IsFire = false; } if (SetPanel.GetInstance() != null) { bPlayerOnRocket = false; } //2p start button chang ffffffffffffffffffffffffffffffffffffff lxy if (bPlayerStartKeyDownP2) { bPlayerStartKeyDownP2 = false; if (CtrlForHardWare.GetInstance() != null) { CtrlForHardWare.GetInstance().OnClickBeginBt2P(); } } } //9-6 - chuan gan if ((bufferKey[9] & 0x40) == 0x40) { //speed jiasuChuanganqi = true; } else { jiasuChuanganqi = false; } //9-4 - 2pshooting if (!bPlayerOnShootP2 && (bufferKey[9] & 0x10) == 0x10) { bPlayerOnShootP2 = true; } else if (bPlayerOnShootP2 && (bufferKey[9] & 0x10) == 0x00) { bPlayerOnShootP2 = false; if (SetPanel.GetInstance()) { SetPanel.GetInstance().OnClickOtherButtonInPanel(); } } //9-5 - 2p daodan if (!bPlayerOnRocketP2 && (bufferKey[9] & 0x20) == 0x20) { bPlayerOnRocketP2 = true; } else if (bPlayerOnRocketP2 && (bufferKey[9] & 0x20) == 0x00) { bPlayerOnRocketP2 = false; if (SetPanel.GetInstance()) { SetPanel.GetInstance().OnClickOtherButtonInPanel(); } } //8-6 - 1p daodan if (!bPlayerOnRocketP1 && (bufferKey[8] & 0x40) == 0x40) { bPlayerOnRocketP1 = true; } else if (bPlayerOnRocketP1 && (bufferKey[8] & 0x40) == 0x00) { bPlayerOnRocketP1 = false; if (SetPanel.GetInstance()) { SetPanel.GetInstance().OnClickOtherButtonInPanel(); } } }
// Use this for initialization void Start() { _Instance = this; pcvr.ResetBikeZuLiInfo(); fileName = GlobalData.fileName; XkGameCtrl.IsLoadingLevel = false; pcvr.OpenGameDongGan(); if (pcvr.bIsHardWare) { pcvr.GetInstance(); pcvr.CloseFangXiangPanPower(); } InitCeShiInfo(); //reset IsSelectGameMode StartSenceChangeUI.IsSelectGameMode = false; if (JiaoZhunObj != null) { JiaoZhunObj.SetActive(false); } if (handleJsonObj == null) { handleJsonObj = HandleJson.GetInstance(); } GameAudioVolume = GlobalData.GetInstance().ReadGameAudioVolume(); GameAudioVolumeLB.text = GameAudioVolume.ToString(); //init start coin string startCoinInfo = handleJsonObj.ReadFromFileXml(fileName, "START_COIN"); if (startCoinInfo == null || startCoinInfo == "") { startCoinInfo = "1"; handleJsonObj.WriteToFileXml(fileName, "START_COIN", startCoinInfo); } startCoin = Convert.ToInt32(startCoinInfo); if (startCoin <= 0) { startCoin = 1; } startCoin--; setStartCoinInfo(); //game mode init string lianJiStateStr = handleJsonObj.ReadFromFileXml(fileName, "LinkModeState"); if (lianJiStateStr == null || lianJiStateStr == "") { lianJiStateStr = "0"; } SetGameLinkMode(lianJiStateStr); string mianFeiStr = handleJsonObj.ReadFromFileXml(fileName, "GAME_MODE"); if (mianFeiStr == null || mianFeiStr == "") { mianFeiStr = "0"; } setGameMode(mianFeiStr); //game diff init string gameDiffStr = handleJsonObj.ReadFromFileXml(fileName, "GAME_DIFFICULTY"); if (gameDiffStr == null || gameDiffStr == "") { gameDiffStr = "1"; } setGameDiff(gameDiffStr); //game language init GameTextType gameTextTmp = GlobalData.GetGameTextMode(); setGameText(gameTextTmp); ResetFangXiangJiaoZhun(); ResetShaCheJiaoZhun(); ResetJiaoTaBanJiaoZhun(1); ResetYouMenJiaoZhun(1); InitBikeZuLiDengJi(); moveBtUp(); //init InputEventCtrl.GetInstance().ClickSetEnterBtEvent += ClickSetEnterBtEvent; InputEventCtrl.GetInstance().ClickSetMoveBtEvent += ClickSetMoveBtEvent; InputEventCtrl.GetInstance().ClickStartBtEvent += ClickStartBtEvent; InputEventCtrl.GetInstance().ClickFireBtEvent += ClickFireBtEvent; InputEventCtrl.GetInstance().ClickStopDongGanBtEvent += ClickStopDongGanBtEvent; }