public void SetVol(float percent) { BackStageSetting bss = GameMain.Singleton.BSSetting; if (percent < 0F) { percent = 0F; } else if (percent > 1F) { percent = 1F; } if (percent == bss.Dat_SoundVolum.Val && percent == bss.Dat_BGMVolum.Val) { return; } bss.Dat_SoundVolum.Val = percent; bss.Dat_BGMVolum.Val = percent; GetComponent <AudioSource>().volume = AudioSrc_Bgm.volume = percent; if (GameMain.EvtSoundVolumeChanged != null) { GameMain.EvtSoundVolumeChanged(percent); } }
/// <summary> /// �ⲿ�����Զ����ˮֵ /// </summary> /// <param name="coin">��ֵ</param> public void FreeGainCustom(int coin) { if(mBss == null) mBss = GameMain.Singleton.BSSetting; if (mBss.Dat_GainAdjustIdx.Val != 0) { Debug.LogWarning("�ڳ��ˮ״̬�µ����Զ�����ˮ,FreeGainCustom()������Ч"); return; } mBss.Dat_GainAdjustIdx.Val = 24; LossProfitData[24] = coin; GameMain.EvtPlayerGunFired += Handle_PlayerFire; GameMain.Evt_PlayerGainScoreFromFish += Handle_PlayerGainScoreFromFish; if (GainAdjust_GainScoreRT == null) GainAdjust_GainScoreRT = new PersistentData<int, int>("GainAdjust_GainScoreRT"); if (GainAdjust_LossScoreRT == null) GainAdjust_LossScoreRT = new PersistentData<int, int>("GainAdjust_LossScoreRT"); mScoreGain = GainAdjust_GainScoreRT.Val = 0; mScoreLoss = GainAdjust_LossScoreRT.Val = 0; mCurLossProfitScore = LossProfitData[mBss.Dat_GainAdjustIdx.Val] * mBss.InsertCoinScoreRatio.Val; StopCoroutine("_Coro_SaveGainData"); StartCoroutine("_Coro_SaveGainData"); StopCoroutine("_Coro_LossOrProfitprocess"); StartCoroutine("_Coro_LossOrProfitprocess"); }
/// <summary> /// 改变押分 /// </summary> /// <returns></returns> IEnumerator _Coro_ChangeNeedScore() { if (!CanChangeScore) { yield break; } BackStageSetting bss = GameMain.Singleton.BSSetting; GunLevelType preType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); GunInst.AdvanceNeedScore(); GunLevelType curType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); if (curType != preType) { On_GunLevelTypeChanged(curType); } yield return(new WaitForSeconds(0.2F)); while (CanChangeScore) { preType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); GunInst.AdvanceNeedScore(); curType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); if (curType != preType) { On_GunLevelTypeChanged(curType); } yield return(new WaitForSeconds(0.1F)); } }
void ScoreDown(bool isAll) { BackStageSetting bss = GameMain.Singleton.BSSetting; if (isAll) { int scoreDown = (bss.Dat_PlayersScore[Idx].Val / bss.InsertCoinScoreRatio.Val) * bss.InsertCoinScoreRatio.Val; ChangeScore(-scoreDown); int numCoin = scoreDown / bss.InsertCoinScoreRatio.Val; bss.His_CoinDown.Val += numCoin; bss.His_GainCurrent.Val -= numCoin; bss.UpdateGainCurrentAndTotal(); } else { int requireDown = bss.InsertCoinScoreRatio.Val * 10; if (requireDown <= bss.Dat_PlayersScore[Idx].Val) { ChangeScore(-requireDown); int numCoin = requireDown / bss.InsertCoinScoreRatio.Val; bss.His_CoinDown.Val += numCoin; bss.His_GainCurrent.Val -= numCoin; bss.UpdateGainCurrentAndTotal(); } } //声音 GameMain.Singleton.SoundMgr.PlayOneShot(GameMain.Singleton.SoundMgr.snd_AddScore); }
void Awake() { mBss = GameMain.Singleton.BSSetting; GameMain.EvtPlayerGunFired += Handle_PlayerGunFired; GameMain.EvtBulletDestroy += Handle_PlayerBulletDestroy; GameMain.EvtMainProcess_FirstEnterScene += Handle_FirstEnterScene; }
void Awake() { mBss = GameMain.Singleton.BSSetting; GameMain.EvtPlayerGunFired += Handle_PlayerGunFired; GameMain.EvtBulletDestroy += Handle_PlayerBulletDestroy; GameMain.EvtMainProcess_FirstEnterScene += Handle_FirstEnterScene; }
void OnEnable() { GameMain.EvtInputKey += Handle_InputKey; BackStageSetting bs = GameMain.Singleton.BSSetting; BackstageMain bsm = BackstageMain.Singleton; //设置显示的数据 Text_ViewInfos[0].text = bs.His_GainTotal.Val.ToString() + " " + bsm.Unit_Coin.CurrentText; Text_ViewInfos[1].text = bs.His_GainPrevious.Val.ToString() + " " + bsm.Unit_Coin.CurrentText; Text_ViewInfos[2].text = bs.His_GainCurrent.Val.ToString() + " " + bsm.Unit_Coin.CurrentText; Text_ViewInfos[3].text = bs.His_CoinUp.Val.ToString() + " " + bsm.Unit_Coin.CurrentText; Text_ViewInfos[4].text = bs.His_CoinDown.Val.ToString() + " " + bsm.Unit_Coin.CurrentText; Text_ViewInfos[5].text = bs.His_CoinInsert.Val.ToString() + " " + bsm.Unit_Coin.CurrentText; Text_ViewInfos[6].text = bs.His_CoinOut.Val.ToString() + " " + bsm.Unit_Coin.CurrentText; Text_ViewInfos[7].text = bs.His_TicketOut.Val.ToString() + " " + bsm.Unit_Ticket.CurrentText; Text_ViewInfos[8].text = bs.Dat_IdLine.Val.ToString(); Text_ViewInfos[9].text = bs.Dat_IdTable.Val.ToString(); Text_ViewInfos[10].text = bs.GetRemainRuntime().ToString() + " " + bsm.Unit_Minute.CurrentText; Text_ViewInfos[11].text = bs.His_NumCodePrint.Val.ToString() + " " + bsm.Unit_Times.CurrentText; foreach (tk2dTextMesh t in Text_ViewInfos) { t.Commit(); } BackstageMain.Singleton.UpdateCursor(CursorLocal); }
/// <summary> /// ������������ /// </summary> void ClearAllData() { if (GameMain.EvtBGClearAllData_Before != null) { GameMain.EvtBGClearAllData_Before(); } BackStageSetting bsSetting = GameMain.Singleton.BSSetting; bsSetting.His_GainTotal.Val = 0; bsSetting.His_GainPrevious.Val = 0; bsSetting.His_GainCurrent.Val = 0; bsSetting.His_CoinUp.Val = 0; bsSetting.His_CoinDown.Val = 0; bsSetting.His_CoinInsert.Val = 0; bsSetting.His_CoinOut.Val = 0; bsSetting.His_TicketOut.Val = 0; #if TEMP_ADD_FIREANDGAIN bsSetting.His_ScoreFire.Val = 0; bsSetting.His_ScoreGain.Val = 0; #endif for (int i = 0; i != Defines.MaxNumPlayer; ++i) { bsSetting.Dat_PlayersScore[i].Val = 0; bsSetting.Dat_PlayersGunScore[i].Val = bsSetting.GetScoreMin(); bsSetting.Dat_PlayersScoreWon[i].Val = 0; } bsSetting.TicketOutFragment.Val = 0; }
private int mLaguageType; //0为中文,1为英文 // Use this for initialization void Start() { mBss = GameMain.Singleton.BSSetting; if (mBss.LaguageUsing.Val == Language.Cn) { mLaguageType = 0; } else { mLaguageType = 1; } mUpdateDatas = new int[] { mBss.His_GainTotal.Val , mBss.His_GainCurrent.Val , mBss.His_CoinUp.Val , mBss.His_CoinDown.Val , mBss.His_CoinInsert.Val , mBss.His_CoinOut.Val , mBss.His_TicketOut.Val , mBss.GetRemainRuntime() }; UpdateView(); }
/// <summary> /// 按键退币 - 报故障 /// </summary> /// <remarks>在按键退币模式下,不够币的话提示故障后不会重退</remarks> /// <returns></returns> IEnumerator _Coro_OutBountyErrorView() { if (mGOViewingOutBountyHint != null) { Destroy(mGOViewingOutBountyHint); } BackStageSetting bss = GameMain.Singleton.BSSetting; if (bss.OutBountyType_.Val == OutBountyType.OutCoinButtom) { mGOViewingOutBountyHint = Instantiate(Prefab_OutBountyHints[2]) as GameObject; } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketButtom) { mGOViewingOutBountyHint = Instantiate(Prefab_OutBountyHints[3]) as GameObject; } mGOViewingOutBountyHint.transform.parent = transform; mGOViewingOutBountyHint.transform.localPosition = LocalOutBountyHint; mGOViewingOutBountyHint.transform.localRotation = Quaternion.identity; yield return(new WaitForSeconds(5F)); Destroy(mGOViewingOutBountyHint); mGOViewingOutBountyHint = null; }
public void Fire(Player from, Fish tar, Quaternion dir) { GameMain gm = GameMain.Singleton; if (tar != null) { mTargetFish = tar; IsLockingFish = true; Vector3 targetDir = tar.transform.position - mTs.position; targetDir.z = 0F; targetDir.Normalize(); targetDir = Quaternion.Euler(0F, 0F, Random.Range(-90F, 90F)) * targetDir + from.transform.up;//得出子弹偏向 Random.Range(0,2)==0?-90F:90F mTs.rotation = Quaternion.FromToRotation(Vector3.up, targetDir); } else { IsLockingFish = false; mTs.rotation = dir; } mTs.parent = gm.TopLeftTs; Text_CoinNum.text = Score.ToString(); Text_CoinNum.Commit(); Owner = from; ++Owner.GunInst.NumBulletInWorld; BackStageSetting bss = gm.BSSetting; if (bss.IsBulletCrossWhenScreenNet.Val && gm.IsScreenNet()) { MoveArea = gm.WorldDimension; } else { MoveArea = from.AtScreenArea; } if (mBulletGO == null) { mBulletGO = Pool_GameObj.GetObj(Prefab_GoAnisprBullet); tk2dSpriteAnimator aniSprBullet = mBulletGO.GetComponent <tk2dSpriteAnimator>(); if (aniSprBullet != null) { //aniSprBullet.clipId = aniSprBullet.GetClipIdByName(Prefab_SpriteNameSet.Texts[from.Idx % Prefab_SpriteNameSet.Texts.Length]); //Debug.Log(Prefab_SpriteNameSet.Texts[from.Idx % Prefab_SpriteNameSet.Texts.Length]); aniSprBullet.Play(Prefab_SpriteNameSet.Texts[from.Idx % Prefab_SpriteNameSet.Texts.Length]); //aniSprBullet.PlayFrom("1",0.1F); } mBulletGO.SetActive(true); mBulletGO.transform.parent = mTs; mBulletGO.transform.localPosition = Vector3.zero; mBulletGO.transform.localRotation = Quaternion.identity; } }
void Handle_InputConfirm(int[] digits) { bool codePrintSuccess = true; //�������� //�Ƿ���ȷ�� uint codeInput = 0; for (int i = 0; i != 8; ++i) { codeInput += (uint)(digits[7 - i] * Mathf.Pow(10F, i)); } BackStageSetting bsSetting = GameMain.Singleton.BSSetting; uint codeConfirm = HF_CodePrint.GenerateComfirmCode(bsSetting.His_GainTotal.Val, bsSetting.His_GainCurrent.Val , bsSetting.Dat_IdLine.Val, (uint)bsSetting.Dat_IdTable.Val, (uint)bsSetting.His_NumCodePrint.Val , (uint)GameMain.Singleton.BSSetting.Dat_FormulaCode.Val, (uint)GameMain.GameIdx); uint gainIdx = 0; uint gainRatioMulti = 0; codePrintSuccess = HF_CodePrint.VerifyPrintCode(codeInput, bsSetting.His_GainTotal.Val , bsSetting.His_GainCurrent.Val , (uint)bsSetting.Dat_IdTable.Val , (uint)bsSetting.His_NumCodePrint.Val , codeConfirm , ref gainIdx , ref gainRatioMulti); //�������� if (codePrintSuccess) { if (!bsSetting.CodePrintCurrentAction.Val) { CurrentToTotalGain();//�鵽���� } else//���δ���,ǰ������,����ˮ { ClearAllData(); } bsSetting.Dat_CodePrintDateTime.Val = System.DateTime.Now.Ticks; bsSetting.His_NumCodePrint.Val += 1; //bsSetting.Dat_GainAdjustIdx.SetImmdiately(((int)gainIdx)); bsSetting.Dat_RemoteDiffucltFactor.SetImmdiately(gainRatioMulti); } StartCoroutine(_Coro_CodePrintResult(codePrintSuccess, digits)); }
public void ChangeNeedScore(int newScore) { BackStageSetting bss = GameMain.Singleton.BSSetting; GunLevelType preType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); GunInst.SetNeedScore(newScore); GunLevelType curType = Gun.GunNeedScoreToLevelType(bss.Dat_PlayersGunScore[Idx].Val); if (curType != preType) { On_GunLevelTypeChanged(curType); } }
/// <summary> /// ������ӯ��������ӯ���� /// </summary> void CurrentToTotalGain() { BackStageSetting bsSetting = GameMain.Singleton.BSSetting; bsSetting.His_GainPrevious.Val += bsSetting.His_GainCurrent.Val; bsSetting.His_GainCurrent.Val = 0; bsSetting.His_GainTotal.Val = bsSetting.His_GainPrevious.Val; //for (int i = 0; i != Defines.MaxNumPlayer; ++i) //{ // bsSetting.Dat_PlayersScore[i].Val = 0; // bsSetting.Dat_PlayersGunScore[i].Val = bsSetting.GetScoreMin(); //} //bsSetting.TicketOutFragment.Val = 0; }
/// <summary> /// 直接设置押分 /// </summary> public void SetNeedScore(int newScore) { BackStageSetting bss = GameMain.Singleton.BSSetting; Text_NeedCoin.text = newScore.ToString(); Text_NeedCoin.Commit(); bss.Dat_PlayersGunScore[mOwner.Idx].Val = newScore;//记录 //音效 if (GameMain.Singleton.SoundMgr.snd_exchangeGun_1 != null) { GameMain.Singleton.SoundMgr.PlayOneShot(GameMain.Singleton.SoundMgr.snd_exchangeGun_1); } }
//void Handle_InputKey(int control, HpyInputKey key, bool down) //{ // if (down && key == HpyInputKey.BS_Confirm) // { // BackToMainMenu(); // } //} /// <summary> /// �Ƿ��������ݶ���ʼ���� /// </summary> /// <returns></returns> bool IsAllDataInited() { BackStageSetting bsSetting = GameMain.Singleton.BSSetting; if (bsSetting.His_GainTotal.Val != 0) { return(false); } if (bsSetting.His_GainPrevious.Val != 0) { return(false); } if (bsSetting.His_GainCurrent.Val != 0) { return(false); } if (bsSetting.His_CoinUp.Val != 0) { return(false); } if (bsSetting.His_CoinDown.Val != 0) { return(false); } if (bsSetting.His_CoinInsert.Val != 0) { return(false); } if (bsSetting.His_CoinOut.Val != 0) { return(false); } if (bsSetting.His_TicketOut.Val != 0) { return(false); } for (int i = 0; i != Defines.MaxNumPlayer; ++i) { if (bsSetting.Dat_PlayersScore[i].Val != 0 || bsSetting.Dat_PlayersGunScore[i].Val != bsSetting.GetScoreMin() || bsSetting.Dat_PlayersScoreWon[i].Val != 0) { return(false); } } return(true); }
/// <summary> /// 玩家赢得币,综合ChangeScore和WonScore /// </summary> /// <param name="num"></param> public void GainScore(int scoreTotalGetted, int fishodd, int bulletScore) { BackStageSetting bss = GameMain.Singleton.BSSetting; if (bss.OutBountyType_.Val == OutBountyType.OutCoinButtom || bss.OutBountyType_.Val == OutBountyType.OutTicketButtom) { ChangeScore(scoreTotalGetted); //币堆.效果 //Ef_CoinStack.RequestViewOneStack(scoreTotalGetted, fishodd, bulletScore, Idx); } else if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate || bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate) { WonScore(scoreTotalGetted); } }
void UpdateView() { BackStageSetting bs = GameMain.Singleton.BSSetting; BackstageMain bsm = BackstageMain.Singleton; //������ʾ������ Text_ViewInfos[0].text = bs.His_GainTotal.Val.ToString() + " " + bsm.Unit_Coin.CurrentText; Text_ViewInfos[1].text = bs.His_GainCurrent.Val.ToString() + " " + bsm.Unit_Coin.CurrentText; Text_ViewInfos[2].text = bs.Dat_IdTable.Val.ToString(); Text_ViewInfos[3].text = bs.His_NumCodePrint.Val.ToString() + " " + bsm.Unit_Times.CurrentText; Text_ViewInfos[4].text = string.Format("{0:d4}", HF_CodePrint.GenerateComfirmCode(bs.His_GainTotal.Val, bs.His_GainCurrent.Val , bs.Dat_IdLine.Val, (uint)bs.Dat_IdTable.Val, (uint)bs.His_NumCodePrint.Val, (uint)GameMain.Singleton.BSSetting.Dat_FormulaCode.Val, (uint)GameMain.GameIdx)); foreach (tk2dTextMesh t in Text_ViewInfos) { t.Commit(); } }
/// <summary> /// ������ʾ /// </summary> void UpdateView() { if (mCurWndOptioner == null) { return; } Ui_lineIdTableIdLink idLink = mCurWndOptioner.GetComponent <Ui_lineIdTableIdLink>(); if (idLink == null) { return; } BackStageSetting bss = GameMain.Singleton.BSSetting; switch (mUIState) { case UIState.Admin: idLink.Text_LineID.text = string.Format("{0:d" + BackStageSetting.Digit_IdLine.ToString() + "}", bss.Dat_IdLine.Val); idLink.Text_LineID.Commit(); idLink.Text_TableID.text = string.Format("{0:d" + BackStageSetting.Digit_IdTable.ToString() + "}", bss.Dat_IdTable.Val); idLink.Text_TableID.Commit(); break; case UIState.Arena: idLink.Text_TableID.text = string.Format("{0:d" + BackStageSetting.Digit_IdTable.ToString() + "}", bss.Dat_IdTable.Val); idLink.Text_TableID.Commit(); if (bss.Dat_FormulaCode.Val == 0xffffffff) { idLink.Text_FormulaCode.text = "-"; } else { idLink.Text_FormulaCode.text = string.Format("{0:d" + BackStageSetting.Digit_FormulaCode.ToString() + "}", bss.Dat_FormulaCode.Val); } idLink.Text_FormulaCode.Commit(); break; } }
/// <summary> /// 外部调用自定义放水值 /// </summary> /// <param name="coin">币值</param> public void FreeGainCustom(int coin) { if (mBss == null) { mBss = GameMain.Singleton.BSSetting; } if (mBss.Dat_GainAdjustIdx.Val != 0) { Debug.LogWarning("在抽放水状态下调用自定义抽放水,FreeGainCustom()调用无效"); return; } mBss.Dat_GainAdjustIdx.Val = 24; LossProfitData[24] = coin; GameMain.EvtPlayerGunFired += Handle_PlayerFire; GameMain.Evt_PlayerGainScoreFromFish += Handle_PlayerGainScoreFromFish; if (GainAdjust_GainScoreRT == null) { GainAdjust_GainScoreRT = new PersistentData <int, int>("GainAdjust_GainScoreRT"); } if (GainAdjust_LossScoreRT == null) { GainAdjust_LossScoreRT = new PersistentData <int, int>("GainAdjust_LossScoreRT"); } mScoreGain = GainAdjust_GainScoreRT.Val = 0; mScoreLoss = GainAdjust_LossScoreRT.Val = 0; mCurLossProfitScore = LossProfitData[mBss.Dat_GainAdjustIdx.Val] * mBss.InsertCoinScoreRatio.Val; StopCoroutine("_Coro_SaveGainData"); StartCoroutine("_Coro_SaveGainData"); StopCoroutine("_Coro_LossOrProfitprocess"); StartCoroutine("_Coro_LossOrProfitprocess"); }
public void AdvanceNeedScore() { BackStageSetting bss = GameMain.Singleton.BSSetting; int gunScoreCurrent = bss.Dat_PlayersGunScore[mOwner.Idx].Val; gunScoreCurrent += bss.ScoreChangeValue.Val; if (gunScoreCurrent > bss.ScoreMax.Val) { gunScoreCurrent = bss.GetScoreMin(); } Text_NeedCoin.text = gunScoreCurrent.ToString(); Text_NeedCoin.Commit(); bss.Dat_PlayersGunScore[mOwner.Idx].Val = gunScoreCurrent;//记录 //音效 if (GameMain.Singleton.SoundMgr.snd_exchangeGun_1 != null) { GameMain.Singleton.SoundMgr.PlayOneShot(GameMain.Singleton.SoundMgr.snd_exchangeGun_1); } }
//GunType mCurGunType = GunType.Normal; //void OnGUI() //{ // if (Idx == 0 && GUILayout.Button("change gun")) // { // if (mCurGunType == GunType.Normal) // { // ChangeGun(GunType.Lizi); // mCurGunType = GunType.Lizi; // } // else if (mCurGunType == GunType.Lizi) // { // ChangeGun(GunType.Normal); // mCurGunType = GunType.Normal; // } // } //} public void ScoreUp(bool isMultiTen) { BackStageSetting bss = GameMain.Singleton.BSSetting; int numCoin = 10 * (isMultiTen ? 10 : 1); int score = bss.InsertCoinScoreRatio.Val * numCoin; //判断是否爆机 if (bss.Dat_PlayersScore[Idx].Val + score >= Defines.NumScoreUpMax) { return; } ChangeScore(score); //上分 bss.His_CoinUp.Val += numCoin; bss.His_GainCurrent.Val += numCoin; bss.UpdateGainCurrentAndTotal(); //声音 GameMain.Singleton.SoundMgr.PlayOneShot(GameMain.Singleton.SoundMgr.snd_AddScore); }
/// <summary> /// 改变分数(面板分数) /// </summary> /// <param name="change"></param> /// <returns>改变是否成功</returns> public bool ChangeScore(int change) { //if (!CanChangeScore) // return false; BackStageSetting bss = GameMain.Singleton.BSSetting; // if (bss.Dat_PlayersScore[Idx].Val + change < mScoreChangeLowest) { return(false); } bss.Dat_PlayersScore[Idx].Val += change; if (GameMain.EvtPlayerScoreChanged != null) { GameMain.EvtPlayerScoreChanged(this, bss.Dat_PlayersScore[Idx].Val, change); } //面板分数 // Text_Score.text = bss.Dat_PlayersScore[Idx].Val.ToString(); //Text_Score.Commit(); return(true); }
void OnEnable() { //mArenaStrs = new string[] { "С�ͳ���ר�ó���", "���ͳ���ר�ó���", "���ͳ���ר�ó���" }; GameMain.EvtInputKey += Handle_InputKey; Box_Decoder.Ctrl_DecodeNum.Num = 12;//12λ�� Box_Decoder.Ctrl_DecodeNum.EvtConfirm += Handle_DecodeNumInputConfirm; if (CursorLocals != null && CursorLocals.Length != 0) { BackstageMain.Singleton.UpdateCursor(CursorLocals[mCurCursorIdx]); } BackStageSetting bs = GameMain.Singleton.BSSetting; //��ȡ��Ϣ Text_InsertCoinRatio.text = string.Format("1 {0:s} {1:d} {2:s}", BackstageMain.Singleton.Unit_Coin.CurrentText, bs.InsertCoinScoreRatio.Val, BackstageMain.Singleton.Unit_Score.CurrentText);//"1 " + bs.InsertCoinScoreRatio.Val.ToString(); Text_InsertCoinRatio.Commit(); Text_ArenaType.text = ArenaTexts[(int)bs.ArenaType_.Val].CurrentText; Text_ArenaType.Commit(); Text_CodePrintDay.text = bs.CodePrintDay.Val.ToString() + " " + BackstageMain.Singleton.Unit_Day.CurrentText; Text_CodePrintDay.Commit(); System.DateTime now = System.DateTime.Now; //2009-01-01 00:00:00 Text_SystemTime.text = string.Format("{0:d}-{1:d2}-{2:d2} {3:d2}:{4:d2}:{5:d2}" , now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); Text_SystemTime.Commit(); Text_IsViewCodeBeatSuccess.text = bs.IsViewCodebeatSuccess.Val ? ViewCodeBeatSuccessTexts[1].CurrentText:ViewCodeBeatSuccessTexts[0].CurrentText; Text_IsViewCodeBeatSuccess.Commit(); Text_DeCodeSuccessInfo.GetComponent <Renderer>().enabled = false; Rd_DecodeSuccessBG.enabled = false; StartCoroutine("_Coro_TimeUpdateView"); }
// Use this for initialization void Start() { mBss = GameMain.Singleton.BSSetting; if (mBss.LaguageUsing.Val == Language.Cn) { mLaguageType = 0; } else mLaguageType = 1; mUpdateDatas = new int[] { mBss.His_GainTotal.Val , mBss.His_GainCurrent.Val , mBss.His_CoinUp.Val , mBss.His_CoinDown.Val , mBss.His_CoinInsert.Val , mBss.His_CoinOut.Val , mBss.His_TicketOut.Val ,mBss.GetRemainRuntime() }; UpdateView(); }
/// <summary> /// 按键退币-协同 /// </summary> /// <returns></returns> public IEnumerator _Coro_OutBountyButtom() { if (mIsOutingBounty) { yield break; } BackStageSetting bss = GameMain.Singleton.BSSetting; INemoControlIO arcIO = GameMain.Singleton.ArcIO; int oneBountyNeedScore = 100000000;//不会退 if (bss.OutBountyType_.Val == OutBountyType.OutCoinButtom) { oneBountyNeedScore = bss.InsertCoinScoreRatio.Val; } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketButtom) { oneBountyNeedScore = (int)(((float)bss.InsertCoinScoreRatio.Val) * bss.CoinTicketRatio_Coin.Val / bss.CoinTicketRatio_Ticket.Val); //投币比例(分/币) * 币票比(币/票) = 出一票需要多少分(分/票) } //检查是否够退一币 if (bss.Dat_PlayersScore[Idx].Val < oneBountyNeedScore) { yield break; } //显示退奖中提示 if (mGOViewingOutBountyHint == null) { if (bss.OutBountyType_.Val == OutBountyType.OutCoinButtom) { mGOViewingOutBountyHint = Instantiate(Prefab_OutBountyHints[0]) as GameObject; } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketButtom) { mGOViewingOutBountyHint = Instantiate(Prefab_OutBountyHints[1]) as GameObject; } mGOViewingOutBountyHint.transform.parent = transform; mGOViewingOutBountyHint.transform.localPosition = LocalOutBountyHint; mGOViewingOutBountyHint.transform.localRotation = Quaternion.identity; } mScoreChangeLowest = (uint)oneBountyNeedScore;//设置分数改变下限,防止控制板返回消息时不能扣除 mIsOutingBounty = true; if (bss.OutBountyType_.Val == OutBountyType.OutCoinButtom) { arcIO.OutCoin(1, CtrllerIdx); } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketButtom) { arcIO.OutTicket(1, CtrllerIdx); } bool isBoutyOutted = false; //是否已出奖励 float timeOut = 10F; //超时时间 float elapse = 0F; NemoCtrlIO_EventController outBountyreflect = (int cIdx) => { if (CtrllerIdx == cIdx) { isBoutyOutted = true; } }; if (bss.OutBountyType_.Val == OutBountyType.OutCoinButtom) { arcIO.EvtOutCoinReflect += outBountyreflect; } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketButtom) { arcIO.EvtOutTicketReflect += outBountyreflect; } while (!isBoutyOutted) { if (elapse > timeOut) { StartCoroutine(_Coro_OutBountyErrorView()); //显示故障 mIsOutingBounty = false; mScoreChangeLowest = 0; //恢复改变分数下限 yield break; } elapse += Time.deltaTime; yield return(0); } //出币已应答 if (bss.OutBountyType_.Val == OutBountyType.OutCoinButtom) { arcIO.EvtOutCoinReflect -= outBountyreflect; } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketButtom) { arcIO.EvtOutTicketReflect -= outBountyreflect; } mIsOutingBounty = false; mScoreChangeLowest = 0;//恢复改变分数下限 //历史记录 if (bss.OutBountyType_.Val == OutBountyType.OutCoinButtom) { bss.His_CoinOut.Val += 1; bss.His_GainCurrent.Val -= 1; bss.UpdateGainCurrentAndTotal(); } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketButtom) { bss.His_TicketOut.Val += 1; //所有玩家公用 bss.TicketOutFragment.Val += 1; int outCoinNumBase = bss.TicketOutFragment.Val / bss.CoinTicketRatio_Ticket.Val;//出币基数,乘与CoinTicketRatio_Coin 得出应出多少个整币 if (outCoinNumBase > 0) { bss.His_GainCurrent.Val -= outCoinNumBase * bss.CoinTicketRatio_Coin.Val; bss.TicketOutFragment.Val -= bss.CoinTicketRatio_Ticket.Val; } bss.UpdateGainCurrentAndTotal(); } ChangeScore(-oneBountyNeedScore); //是否可再扣分,可以则迭代 if (bss.Dat_PlayersScore[Idx].Val >= oneBountyNeedScore) { StartCoroutine(_Coro_OutBountyButtom()); } else//退出迭代 { if (mGOViewingOutBountyHint != null) { Destroy(mGOViewingOutBountyHint); mGOViewingOutBountyHint = null; } } }
void Awake() { mBss = GameMain.Singleton.BSSetting; }
void Awake() { mBss = GameMain.Singleton.BSSetting; }
/// <summary> /// 即时退奖 /// </summary> /// <remarks>Dat_PlayersScoreWon中值,可以退奖则扣下</remarks> /// <returns></returns> public IEnumerator _Coro_OutBountyImm() { if (mIsOutingBounty) { yield break; } BackStageSetting bss = GameMain.Singleton.BSSetting; INemoControlIO arcIO = GameMain.Singleton.ArcIO; int oneBountyNeedScore = 100000000;//防止出现bug不会退 if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate) { oneBountyNeedScore = bss.InsertCoinScoreRatio.Val; } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate) { oneBountyNeedScore = (int)(((float)bss.InsertCoinScoreRatio.Val) * bss.CoinTicketRatio_Coin.Val / bss.CoinTicketRatio_Ticket.Val);//投币比例(分/币) * 币票比(币/票) = 出一票需要多少分(分/票) } if (bss.Dat_PlayersScoreWon[Idx].Val < oneBountyNeedScore) { yield break; } mIsOutingBounty = true; //请求硬件扣币 if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate) { arcIO.OutCoin(1, CtrllerIdx); } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate) { arcIO.OutTicket(1, CtrllerIdx); } bool isBoutyOutted = false; //是否已出奖励 float timeOut = 10F; //超时时间 float elapse = 0F; NemoCtrlIO_EventController outBountyreflect = (int cIdx) => { if (CtrllerIdx == cIdx) { isBoutyOutted = true; } }; if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate) { arcIO.EvtOutCoinReflect += outBountyreflect; } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate) { arcIO.EvtOutTicketReflect += outBountyreflect; } while (!isBoutyOutted) { if (elapse > timeOut)// 超时 { //显示退奖错误提示 if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate) { mGOViewingOutBountyHint = Instantiate(Prefab_OutBountyHints[2]) as GameObject; } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate) { mGOViewingOutBountyHint = Instantiate(Prefab_OutBountyHints[3]) as GameObject; } mGOViewingOutBountyHint.transform.parent = transform; mGOViewingOutBountyHint.transform.localPosition = LocalOutBountyHint; mGOViewingOutBountyHint.transform.localRotation = Quaternion.identity; yield return(new WaitForSeconds(30F)); mIsOutingBounty = false; StartCoroutine(_Coro_OutBountyImm()); yield break; } elapse += Time.deltaTime; yield return(0); } //出币已应答 if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate) { arcIO.EvtOutCoinReflect -= outBountyreflect; } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate) { arcIO.EvtOutTicketReflect -= outBountyreflect; } //历史记录 if (bss.OutBountyType_.Val == OutBountyType.OutCoinImmediate) { bss.His_CoinOut.Val += 1; bss.His_GainCurrent.Val -= 1; bss.UpdateGainCurrentAndTotal(); } else if (bss.OutBountyType_.Val == OutBountyType.OutTicketImmediate) { bss.His_TicketOut.Val += 1; //所有玩家公用 bss.TicketOutFragment.Val += 1; int outCoinNumBase = bss.TicketOutFragment.Val / bss.CoinTicketRatio_Ticket.Val;//出币基数,乘与CoinTicketRatio_Coin 得出应出多少个整币 if (outCoinNumBase > 0) { bss.His_GainCurrent.Val -= outCoinNumBase * bss.CoinTicketRatio_Coin.Val; bss.TicketOutFragment.Val -= bss.CoinTicketRatio_Ticket.Val; } bss.UpdateGainCurrentAndTotal(); } if (bss.Dat_PlayersScoreWon[Idx].Val < oneBountyNeedScore) { Debug.LogError("[退奖错误]该扣分数大于玩家已赢分数."); yield break; } bss.Dat_PlayersScoreWon[Idx].Val = bss.Dat_PlayersScoreWon[Idx].Val - oneBountyNeedScore; if (GameMain.EvtPlayerWonScoreChanged != null) { GameMain.EvtPlayerWonScoreChanged(this, bss.Dat_PlayersScoreWon[Idx].Val); } //Ef_CoinStack.OneStack_SetNum(bss.Dat_PlayersScoreWon[Idx].Val); mIsOutingBounty = false; //是否可再扣分,可以则迭代 if (bss.Dat_PlayersScoreWon[Idx].Val >= oneBountyNeedScore) { StartCoroutine(_Coro_OutBountyImm()); } if (mGOViewingOutBountyHint != null) { Destroy(mGOViewingOutBountyHint); mGOViewingOutBountyHint = null; } }
void OnEnable() { GameMain.EvtInputKey += Handle_InputKey; BackStageSetting bsSetting = GameMain.Singleton.BSSetting; mEnterVal_GameDifficult = bsSetting.GameDifficult_.Val; mEnterVal_CoinTicketRatio_Coin = bsSetting.CoinTicketRatio_Coin.Val; mEnterVal_CoinTicketRatio_Ticket = bsSetting.CoinTicketRatio_Ticket.Val; //mEnterVal_IsBulletCross = bsSetting.IsBulletCrossWhenScreenNet.Val; mEnterVal_ScoreChangeValue = bsSetting.ScoreChangeValue.Val; mEnterVal_Scoremax = bsSetting.ScoreMax.Val; //mEnterVal_Scoremin = bsSetting.ScoreMin.Val; mEnterVal_OutBountyType = bsSetting.OutBountyType_.Val; mEnterVal_GunLayoutType = bsSetting.GunLayoutType_.Val; mEnterVal_Language = bsSetting.LaguageUsing.Val; Ctrl_GameDifficul.ViewIdx = (int)mEnterVal_GameDifficult; Ctrl_CoinTicketRatio_Coin.ViewTextFormat = "{0:d} " + BackstageMain.Singleton.Unit_Coin.CurrentText; Ctrl_CoinTicketRatio_Coin.NumViewing = mEnterVal_CoinTicketRatio_Coin; Ctrl_CoinTicketRatio_Ticket.ViewTextFormat = "{0:d} " + BackstageMain.Singleton.Unit_Ticket.CurrentText; Ctrl_CoinTicketRatio_Ticket.NumViewing = mEnterVal_CoinTicketRatio_Ticket; //Ctrl_IsBulletCross.ViewIdx //Ctrl_IsBulletCross.ViewIdx = mEnterVal_IsBulletCross ? 1 : 0; Ctrl_ScoreChangeVal.ViewTextFormat = "{0:d} " + BackstageMain.Singleton.Unit_Score.CurrentText; Ctrl_ScoreChangeVal.NumViewing = mEnterVal_ScoreChangeValue; Ctrl_MaxScore.ViewTextFormat = "{0:d} " + BackstageMain.Singleton.Unit_Score.CurrentText; Ctrl_MaxScore.NumViewing = mEnterVal_Scoremax; //Ctrl_MinScore.ViewTextFormat = "{0:d} " + BackstageMain.Singleton.Unit_Score.CurrentText; //Ctrl_MinScore.NumViewing = mEnterVal_Scoremin; Ctrl_Language.ViewIdx = (int)mEnterVal_Language; if (!bsSetting.Dat_GameShowLanguageSetup.Val) { Renderer r = Ctrl_Language.GetComponentInChildren <Renderer>(); if (r != null) { r.enabled = false; } Transform ts = transform.Find("OptionText/OptionText6"); if (ts != null) { if (ts.GetComponent <Renderer>() != null) { ts.GetComponent <Renderer>().enabled = false; } } } else { Renderer r = Ctrl_Language.GetComponentInChildren <Renderer>(); if (r != null) { r.enabled = true; } Transform ts = transform.Find("OptionText/OptionText6"); if (ts != null) { if (ts.GetComponent <Renderer>() != null) { ts.GetComponent <Renderer>().enabled = true; } } } Ctrl_OutBountyType.ViewIdx = (int)mEnterVal_OutBountyType; Ctrl_GunLayouType.ViewIdx = (int)mEnterVal_GunLayoutType; if (CursorLocals != null && CursorLocals.Length != 0) { BackstageMain.Singleton.UpdateCursor(CursorLocals[mCurCursorIdx]); } //Spr_GunLayoutHint.renderer.enabled = false; Ctrl_GunLayouType.EvtAdvanceing += Handle_Ctrl_GunLayoutType; }
void Handle_InputKey(int control, HpyInputKey key, bool down) { #region keydown if (down && key == HpyInputKey.BS_Up) { SelectPrev(); //StartCoroutine("_Coro_SelectPrev"); } else if (down && key == HpyInputKey.BS_Down) { SelectNext(); //StartCoroutine("_Coro_SelectNext"); } else if (down && key == HpyInputKey.BS_Left) { if (mCurCursorIdx == (int)Option.Difficult)//���� { Ctrl_GameDifficul.StartChange(false); } else if (mCurCursorIdx == (int)Option.CoinTicketRatio)//��Ʊ���� { if (mCurrentCoinTicketRotioSelect == null) { mCurrentCoinTicketRotioSelect = Ctrl_CoinTicketRatio_Coin; mCurrentCoinTicketRotioSelect.GetComponent <Ef_RendererFlash>().StartFlash(); } else { mCurrentCoinTicketRotioSelect.GetComponent <Ef_RendererFlash>().StopFlash(); mCurrentCoinTicketRotioSelect.StartChangeNumViewing(-1); } mIsMainMenuMovable = false;//���˵������ƶ� } else if (mCurCursorIdx == (int)Option._OutBountyType) { Ctrl_OutBountyType.StartChange(false); } else if (mCurCursorIdx == (int)Option._GunLayoutType) { Ctrl_GunLayouType.StartChange(false); } //else if (mCurCursorIdx == 4) // Ctrl_IsBulletCross.StartChange(false); else if (mCurCursorIdx == (int)Option.ScoreChange) { Ctrl_ScoreChangeVal.StartChangeNumViewing((int cur) => { return(-GetChangeValL(cur)); }); } //else if (mCurCursorIdx == 6) // Ctrl_MinScore.StartChangeNumViewing((int cur) => { return -GetChangeValL(cur); }); else if (mCurCursorIdx == (int)Option.MaxGunScore) { Ctrl_MaxScore.StartChangeNumViewing((int cur) => { return(-GetChangeValL(cur)); }); } else if (mCurCursorIdx == (int)Option.LaguageSelect) { Ctrl_Language.StartChange(false); } } else if (down && key == HpyInputKey.BS_Right) { if (mCurCursorIdx == (int)Option.Difficult)//���� { Ctrl_GameDifficul.StartChange(true); } else if (mCurCursorIdx == (int)Option.CoinTicketRatio)//��Ʊ���� { if (mCurrentCoinTicketRotioSelect == null) { mCurrentCoinTicketRotioSelect = Ctrl_CoinTicketRatio_Coin; mCurrentCoinTicketRotioSelect.GetComponent <Ef_RendererFlash>().StartFlash(); } else { mCurrentCoinTicketRotioSelect.GetComponent <Ef_RendererFlash>().StopFlash(); mCurrentCoinTicketRotioSelect.StartChangeNumViewing(1); } mIsMainMenuMovable = false;//���˵������ƶ� } else if (mCurCursorIdx == (int)Option._OutBountyType) { Ctrl_OutBountyType.StartChange(true); } else if (mCurCursorIdx == (int)Option._GunLayoutType) { Ctrl_GunLayouType.StartChange(true); } //else if (mCurCursorIdx == 4) // Ctrl_IsBulletCross.StartChange(true); else if (mCurCursorIdx == (int)Option.ScoreChange) { Ctrl_ScoreChangeVal.StartChangeNumViewing(GetChangeValR); } //else if (mCurCursorIdx == 6) // Ctrl_MinScore.StartChangeNumViewing(GetChangeValR); else if (mCurCursorIdx == (int)Option.MaxGunScore) { Ctrl_MaxScore.StartChangeNumViewing(GetChangeValR); } else if (mCurCursorIdx == (int)Option.LaguageSelect) { Ctrl_Language.StartChange(true); } } else if (down && key == HpyInputKey.BS_Confirm) { //��Ч-��̨ if (GameMain.Singleton.SoundMgr.snd_bkBtn != null) { GameMain.Singleton.SoundMgr.PlayOneShot(GameMain.Singleton.SoundMgr.snd_bkBtn); } if (mCurCursorIdx == (int)Option.CoinTicketRatio)//��Ʊ���� { if (mCurrentCoinTicketRotioSelect == null) { mCurrentCoinTicketRotioSelect = Ctrl_CoinTicketRatio_Coin; mCurrentCoinTicketRotioSelect.GetComponent <Ef_RendererFlash>().StartFlash(); mIsMainMenuMovable = false; } else { mCurrentCoinTicketRotioSelect.GetComponent <Ef_RendererFlash>().StopFlash(); mCurrentCoinTicketRotioSelect = null; mIsMainMenuMovable = true; } } else if (mCurCursorIdx == (int)Option.RecoverSetting)//�ָ�Ĭ��ֵ { Ctrl_GameDifficul.ViewIdx = (int)BackStageSetting.Def_GameDifficult; Ctrl_CoinTicketRatio_Coin.NumViewing = BackStageSetting.Def_CoinTicketRatio_Coin; Ctrl_CoinTicketRatio_Ticket.NumViewing = BackStageSetting.Def_CoinTicketRatio_Ticket; //Ctrl_IsBulletCross.ViewIdx = BackStageSetting.Def_IsBulletCrossWhenScreenNet ? 1 : 0; Ctrl_ScoreChangeVal.NumViewing = BackStageSetting.Def_ScoreChangeValue; Ctrl_MaxScore.NumViewing = BackStageSetting.Def_ScoreMax; //Ctrl_MinScore.NumViewing = BackStageSetting.Def_ScoreMin; Ctrl_OutBountyType.ViewIdx = (int)BackStageSetting.Def_OutBountyType; Ctrl_GunLayouType.ViewIdx = (int)BackStageSetting.Def_GunLayoutType; Ctrl_Language.ViewIdx = (int)BackStageSetting.Def_LanguageUsing; } else if (mCurCursorIdx == (int)Option.SaveSetting)//�����˳� { //���� �Ѷ� �� ��Ʊ �����Ƿ��иı�,�еĻ�����Ҫ������0 ,�����˳� bool needCodePrint = false; //���� BackStageSetting bsSetting = GameMain.Singleton.BSSetting; if ((int)mEnterVal_GameDifficult != Ctrl_GameDifficul.ViewIdx) { bsSetting.GameDifficult_.Val = (GameDifficult)Ctrl_GameDifficul.ViewIdx; needCodePrint = true; } if (mEnterVal_CoinTicketRatio_Coin != Ctrl_CoinTicketRatio_Coin.NumViewing) { bsSetting.CoinTicketRatio_Coin.Val = Ctrl_CoinTicketRatio_Coin.NumViewing; needCodePrint = true; } if (mEnterVal_CoinTicketRatio_Ticket != Ctrl_CoinTicketRatio_Ticket.NumViewing) { bsSetting.CoinTicketRatio_Ticket.Val = Ctrl_CoinTicketRatio_Ticket.NumViewing; needCodePrint = true; } //if ((mEnterVal_IsBulletCross?1:0) != Ctrl_IsBulletCross.ViewIdx) //{ // bsSetting.IsBulletCrossWhenScreenNet.Val = Ctrl_IsBulletCross.ViewIdx == 1 ? true : false; //} if (mEnterVal_ScoreChangeValue != Ctrl_ScoreChangeVal.NumViewing) { bsSetting.ScoreChangeValue.Val = Ctrl_ScoreChangeVal.NumViewing; bsSetting.ScoreMin.Val = Ctrl_ScoreChangeVal.NumViewing; } if (mEnterVal_Scoremax != Ctrl_MaxScore.NumViewing) { bsSetting.ScoreMax.Val = Ctrl_MaxScore.NumViewing; } //if (mEnterVal_Scoremin != Ctrl_MinScore.NumViewing) //{ // bsSetting.ScoreMin.Val = Ctrl_MinScore.NumViewing; //} if ((int)mEnterVal_OutBountyType != Ctrl_OutBountyType.ViewIdx) { bsSetting.OutBountyType_.Val = (OutBountyType)Ctrl_OutBountyType.ViewIdx; } if ((int)mEnterVal_GunLayoutType != Ctrl_GunLayouType.ViewIdx) { bsSetting.GunLayoutType_.Val = (GunLayoutType)Ctrl_GunLayouType.ViewIdx; } if ((int)mEnterVal_Language != Ctrl_Language.ViewIdx) { bsSetting.LaguageUsing.Val = (Language)Ctrl_Language.ViewIdx; if (GameMain.EvtLanguageChange != null) { GameMain.EvtLanguageChange(bsSetting.LaguageUsing.Val); } } if (needCodePrint) { gameObject.SetActiveRecursively(false); GameMain.Singleton.BSSetting.CodePrintCurrentAction.SetImmdiately(false);//��0״̬ GameMain.Singleton.BSSetting.IsCodePrintClearAllData.SetImmdiately(true); //BackstageMain.Singleton.WndCodePrint.gameObject.SetActiveRecursively(true); BackstageMain.Singleton.WndCodePrint.Enter(); } else { BackToMainMenu(); } } else if (mCurCursorIdx == (int)Option.Quit)//�������˳� { //��Ч-��̨ if (GameMain.Singleton.SoundMgr.snd_bkBtn != null) { GameMain.Singleton.SoundMgr.PlayOneShot(GameMain.Singleton.SoundMgr.snd_bkBtn); } BackToMainMenu(); } } #endregion #region keyup if (!down && key == HpyInputKey.BS_Up) { //StopCoroutine("_Coro_SelectPrev"); } else if (!down && key == HpyInputKey.BS_Down) { //StopCoroutine("_Coro_SelectNext"); } else if (!down && key == HpyInputKey.BS_Left) { if (mCurCursorIdx == (int)Option.Difficult) { Ctrl_GameDifficul.StopChange(); } if (mCurCursorIdx == (int)Option.CoinTicketRatio) { if (mCurrentCoinTicketRotioSelect != null) { mCurrentCoinTicketRotioSelect.StopChangeNumViewing(); mCurrentCoinTicketRotioSelect.GetComponent <Ef_RendererFlash>().StartFlash(); } } else if (mCurCursorIdx == (int)Option._OutBountyType) { Ctrl_OutBountyType.StopChange(); } else if (mCurCursorIdx == (int)Option._GunLayoutType) { Ctrl_GunLayouType.StopChange(); } //else if (mCurCursorIdx == 4) // Ctrl_IsBulletCross.StopChange(); else if (mCurCursorIdx == (int)Option.ScoreChange) { Ctrl_ScoreChangeVal.StopChangeNumViewing(); } //else if (mCurCursorIdx == 6) // Ctrl_MinScore.StopChangeNumViewing(); else if (mCurCursorIdx == (int)Option.MaxGunScore) { Ctrl_MaxScore.StopChangeNumViewing(); } else if (mCurCursorIdx == (int)Option.LaguageSelect) { Ctrl_Language.StopChange(); } } else if (!down && key == HpyInputKey.BS_Right) { if (mCurCursorIdx == (int)Option.Difficult) { Ctrl_GameDifficul.StopChange(); } if (mCurCursorIdx == (int)Option.CoinTicketRatio) { if (mCurrentCoinTicketRotioSelect != null) { mCurrentCoinTicketRotioSelect.StopChangeNumViewing(); mCurrentCoinTicketRotioSelect.GetComponent <Ef_RendererFlash>().StartFlash(); } } else if (mCurCursorIdx == (int)Option._OutBountyType) { Ctrl_OutBountyType.StopChange(); } else if (mCurCursorIdx == (int)Option._GunLayoutType) { Ctrl_GunLayouType.StopChange(); } //else if (mCurCursorIdx == 4) // Ctrl_IsBulletCross.StopChange(); else if (mCurCursorIdx == (int)Option.ScoreChange) { Ctrl_ScoreChangeVal.StopChangeNumViewing(); } //else if (mCurCursorIdx == 6) // Ctrl_MinScore.StopChangeNumViewing(); else if (mCurCursorIdx == (int)Option.MaxGunScore) { Ctrl_MaxScore.StopChangeNumViewing(); } else if (mCurCursorIdx == (int)Option.LaguageSelect) { Ctrl_Language.StopChange(); } } #endregion }
//void OnGUI() //{ // if (GUILayout.Button("input code print")) // { // Handle_DecodeNumInputConfirm(new int[] { 6, 8, 7, 3, 2, 8, 9, 2, 0, 3, 1, 7 }); // } //} void Handle_DecodeNumInputConfirm(int[] digits) { BackStageSetting bs = GameMain.Singleton.BSSetting; //���������� ulong codeOri = 0; ulong[] pows = new ulong[12]; for (int i = 0; i != 12; ++i) { pows[i] = 1; } for (int i = 0; i != 12; ++i) { for (int powMulti = 0; powMulti != i; ++powMulti) { pows[i] *= 10; } } for (int i = 0; i != 12; ++i) { codeOri += (ulong)(digits[11 - i]) * pows[i]; } byte[] msgEncrypt = HF_Decoder.MsgFromDecimalCode(codeOri); byte[] msgDecrypt = HF_Decoder.Decrypt_Msg(msgEncrypt, (uint)GameMain.Singleton.BSSetting.Dat_IdTable.Val, mCurTagId); // string msgPlainStr = ""; // foreach (byte b in msgDecrypt) // { // msgPlainStr += string.Format("{0:x2} ", b); // } // Debug.Log("msgPlainStr = " + msgPlainStr); bool needCodePrint = false; //(hqc:����ͨ����У�������Խ��������������⣬����ijЩ������(������)λ������,������Ҫ�Ķ�Ӳ������. //�����ü���.ȱ��:�������Ļ����û���������������ʱ��������������) bool isInputValCorrect = true;//����ֵ�Ƿ��Ϸ��� int codeTypeIdx = -1; HF_Decoder.MsgCode codeType = HF_Decoder.GetMsgPlainType(msgDecrypt); bool isVerifySucess = false; switch (codeType) { case HF_Decoder.MsgCode.TouBiBiLi: { //codeTypeStr = "Ͷ�ұ���"; codeTypeIdx = 0; int val = HF_Decoder.TouBiBiLi_FromMsgPlain(msgDecrypt, (uint)GameMain.Singleton.BSSetting.Dat_IdTable.Val, mCurTagId, out isVerifySucess); if (val < 1 || val > 1000 || !isVerifySucess) { isInputValCorrect = false; break; } bs.InsertCoinScoreRatio.Val = val; Text_InsertCoinRatio.text = "1 �� " + bs.InsertCoinScoreRatio.Val.ToString(); Text_InsertCoinRatio.text = string.Format("1 {0:s} {1:d} {2:s}", BackstageMain.Singleton.Unit_Coin.CurrentText, bs.InsertCoinScoreRatio.Val, BackstageMain.Singleton.Unit_Score.CurrentText); Text_InsertCoinRatio.Commit(); needCodePrint = true; } break; case HF_Decoder.MsgCode.ChangDiLeiXing: { //codeTypeStr = "��������"; codeTypeIdx = 1; ArenaType oldArenaType = bs.ArenaType_.Val; int val = HF_Decoder.ChangeDiLeiXing_FromMsgPlain(msgDecrypt, (uint)GameMain.Singleton.BSSetting.Dat_IdTable.Val, mCurTagId, out isVerifySucess); if (val < 0 || val > 2 || !isVerifySucess) { isInputValCorrect = false; break; } bs.ArenaType_.Val = (ArenaType)val; if (GameMain.EvtBGChangeArenaType != null) { GameMain.EvtBGChangeArenaType(oldArenaType, bs.ArenaType_.Val); } Text_ArenaType.text = ArenaTexts[(int)bs.ArenaType_.Val].CurrentText; Text_ArenaType.Commit(); } break; case HF_Decoder.MsgCode.DaMaTianShu: { //codeTypeStr = "��������"; codeTypeIdx = 2; int val = HF_Decoder.DaMaTianShu_FromMsgPlain(msgDecrypt, (uint)GameMain.Singleton.BSSetting.Dat_IdTable.Val, mCurTagId, out isVerifySucess); if (val < 1 || val > 13 || !isVerifySucess) { isInputValCorrect = false; break; } bs.CodePrintDay.Val = val; Text_CodePrintDay.text = bs.CodePrintDay.Val.ToString() + " " + BackstageMain.Singleton.Unit_Day.CurrentText; Text_CodePrintDay.Commit(); } break; case HF_Decoder.MsgCode.XiTongShiJian: { //codeTypeStr = "ϵͳʱ��"; codeTypeIdx = 3; uint[] timeData = new uint[5]; HF_Decoder.XiTongShiJian_FromMsgPlain(msgDecrypt, out timeData[0], out timeData[1], out timeData[02], out timeData[3], out timeData[4]); if ((int)timeData[1] < 1 || (int)timeData[1] > 12 || (int)timeData[2] < 1 || (int)timeData[2] > 31 || (int)timeData[3] < 0 || (int)timeData[3] > 24 || (int)timeData[4] < 0 || (int)timeData[4] > 60) { isInputValCorrect = false; break; } System.DateTime dt = new System.DateTime((int)timeData[0] + 2000, (int)timeData[1], (int)timeData[2], (int)timeData[3], (int)timeData[4], 0); //����ϵͳʱ�� win32Api.SetLocalTimeByDateTime(dt); //��ʾ Text_SystemTime.text = string.Format("{0:d}-{1:d2}-{2:d2} {3:d2}:{4:d2}:{5:d2}" , dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second); Text_SystemTime.Commit(); } break; case HF_Decoder.MsgCode.XianShiDaMaXinXi: { //codeTypeStr = "�����ɹ���Ϣ"; codeTypeIdx = 4; bs.IsViewCodebeatSuccess.Val = HF_Decoder.XianShiDaMaXinXi_FromMsgPlain(msgDecrypt, (uint)GameMain.Singleton.BSSetting.Dat_IdTable.Val, mCurTagId, out isVerifySucess); if (!isVerifySucess) { isInputValCorrect = false; break; } Text_IsViewCodeBeatSuccess.text = bs.IsViewCodebeatSuccess.Val ? ViewCodeBeatSuccessTexts[1].CurrentText : ViewCodeBeatSuccessTexts[0].CurrentText; Text_IsViewCodeBeatSuccess.Commit(); } break; } if (!isInputValCorrect || codeType == HF_Decoder.MsgCode.None)//��������. { Box_Decoder.ViewErroInput(); } else//�����ɹ� { if (needCodePrint) { mIsCursorMovable = true; Box_Decoder.gameObject.SetActiveRecursively(false); gameObject.SetActiveRecursively(false); GameMain.Singleton.BSSetting.CodePrintCurrentAction.SetImmdiately(false);//��0״̬ GameMain.Singleton.BSSetting.IsCodePrintClearAllData.SetImmdiately(true); //BackstageMain.Singleton.WndCodePrint.gameObject.SetActiveRecursively(true); BackstageMain.Singleton.WndCodePrint.Enter(); } else { mIsCursorMovable = true; Box_Decoder.gameObject.SetActiveRecursively(false); Text_DeCodeSuccessInfo.text = DecodeResultHintTexts[codeTypeIdx].CurrentText;// string.Format("��{0}�����������ɹ�", codeTypeStr); Text_DeCodeSuccessInfo.Commit(); Text_DeCodeSuccessInfo.GetComponent <Renderer>().enabled = true; Rd_DecodeSuccessBG.enabled = true; StartCoroutine(_Coro_DelayDisableSucessInfo()); } } }