void SetupFormulaCode() { mCurWndOptioner.IsControlable = false; //����һ�������� mCurNumInputer = Instantiate(Prefab_NumInputer) as Ctrl_InputNum; mCurNumInputer.Num = BackStageSetting.Digit_FormulaCode; mCurNumInputer.Text_Tile.text = LI_PlzEnterFormulaCode.CurrentText; mCurNumInputer.Text_Tile.Commit(); mCurNumInputer.transform.parent = transform; mCurNumInputer.transform.localPosition = TsLocal_NumInputer.localPosition; mCurNumInputer.EvtConfirm = (int[] digits) => { if (digits.Length == BackStageSetting.Digit_FormulaCode) { uint formulaCodeNew = (uint)Ctrl_InputNum.DigitToInt(digits); if (formulaCodeNew == 0) { formulaCodeNew = 0xffffffff; } GameMain.Singleton.BSSetting.Dat_FormulaCode.SetImmdiately(formulaCodeNew); Destroy(mCurNumInputer.gameObject); mCurNumInputer = null; mCurWndOptioner.IsControlable = true; ViewHint(LI_SetupFormulaCodeSucess.CurrentText); UpdateView(); } else { ViewHint(LI_FormulaDigitNumWorng.CurrentText); } }; }
void SetupPsw(string pswName) { mCurWndOptioner.IsControlable = false; //����һ�������� mCurNumInputer = Instantiate(Prefab_NumInputer) as Ctrl_InputNum; mCurNumInputer.Num = Defines.PswLength; mCurNumInputer.Text_Tile.text = LI_PlzEnterNewPsw.CurrentText; mCurNumInputer.Text_Tile.Commit(); mCurNumInputer.transform.parent = transform; mCurNumInputer.transform.localPosition = TsLocal_NumInputer.localPosition; ulong pswInputFirst = 0; int pswInputState = 1; //1��һ������,2�ڶ������� mCurNumInputer.EvtConfirm = (int[] digits) => { if (digits.Length == Defines.PswLength) { if (pswInputState == 1) { pswInputFirst = Ctrl_InputNum.DigitToInt(digits); mCurNumInputer.ResetDigits(); mCurNumInputer.Text_Tile.text = LI_EnterPswAgain.CurrentText; mCurNumInputer.Text_Tile.Commit(); pswInputState = 2; } else if (pswInputState == 2) { ulong pswInputSecond = Ctrl_InputNum.DigitToInt(digits); //�ڶ����������� if (pswInputFirst == pswInputSecond) { byte[] md5Psw = Cryptor.ComputeHash(System.Text.Encoding.ASCII.GetBytes(pswInputSecond.ToString())); string md5PswStr = System.Text.Encoding.ASCII.GetString(md5Psw); WritePswMD5(pswName, md5PswStr); Destroy(mCurNumInputer.gameObject); mCurNumInputer = null; mCurWndOptioner.IsControlable = true; ViewHint(LI_SetupPswSucess.CurrentText); } else //�����������벻һ�� { mCurNumInputer.ResetDigits(); mCurNumInputer.Text_Tile.text = LI_PlzEnterNewPsw.CurrentText; mCurNumInputer.Text_Tile.Commit(); pswInputState = 1; ViewHint(LI_EnteredPswNotSame.CurrentText); } } } else { ViewHint(string.Format(LI_EnterNDigitPsw.CurrentText, Defines.PswLength)); } }; }
public bool TryEnter(int[] psw) { string pswStr = Ctrl_InputNum.DigitToInt(psw).ToString(); string pswInputCryptedStr = System.Text.Encoding.ASCII.GetString(Cryptor.ComputeHash(System.Text.Encoding.ASCII.GetBytes(pswStr))); string pswAdminSavedStr = ReadGamePswMD5("adminPsw"); //arenaģʽ string pswArenaSavedStr = ReadGamePswMD5("arenaPsw"); if (pswArenaSavedStr == "" && pswStr == "822228")//Ӳ��û������, { Enter(UIState.Arena); return(true); } if (pswArenaSavedStr == pswInputCryptedStr) { Enter(UIState.Arena); return(true); } //����adminģʽ if (pswAdminSavedStr == "" && pswStr == "911119")//Ӳ��û������ { Enter(UIState.Admin); return(true); } if (pswAdminSavedStr == pswInputCryptedStr) { Enter(UIState.Admin); return(true); } return(false); }
/// <summary> /// �����ߺŻ���̨�� /// </summary> /// <param name="lineIdOrTableID">true:�ߺ�,false:̨��</param> /// <param name="numLen"></param> void SetupLineIDOrTableID(bool lineIdOrTableID, int numLen) { mCurWndOptioner.IsControlable = false; //����һ�������� mCurNumInputer = Instantiate(Prefab_NumInputer) as Ctrl_InputNum; mCurNumInputer.Num = numLen; mCurNumInputer.Text_Tile.text = lineIdOrTableID ? LI_PlzEnterNewLineID.CurrentText: LI_PlzEnterNewTableID.CurrentText; mCurNumInputer.Text_Tile.Commit(); mCurNumInputer.transform.parent = transform; mCurNumInputer.transform.localPosition = TsLocal_NumInputer.localPosition; mCurNumInputer.EvtConfirm = (int[] digits) => { if (digits.Length == numLen) { if (lineIdOrTableID) { GameMain.Singleton.BSSetting.Dat_IdLine.SetImmdiately((int)Ctrl_InputNum.DigitToInt(digits)); } else { GameMain.Singleton.BSSetting.Dat_IdTable.SetImmdiately((int)Ctrl_InputNum.DigitToInt(digits)); } Destroy(mCurNumInputer.gameObject); mCurNumInputer = null; mCurWndOptioner.IsControlable = true; ViewHint(LI_SetupLineIdSuccess.CurrentText); UpdateView(); } else { ViewHint(LI_Enter3DigitLineID.CurrentText); } }; }
void Handle_Input(int control, HpyInputKey key, bool down) { if (key == HpyInputKey.BS_Cancel && down) { if (mCurNumInputer != null) { Destroy(mCurNumInputer.gameObject); mCurNumInputer = null; mCurWndOptioner.IsControlable = true; } } else if ((key == HpyInputKey.BS_Left || key == HpyInputKey.BS_Right) && down) { if (mCurSelectIdx == 4) { Transform ts = mCurWndOptioner.transform.Find("option4/ctrl_��ǰ��ʾ״̬"); Ctrl_OptionText ctrlOption = null; if (ts != null) { ctrlOption = ts.GetComponent <Ctrl_OptionText>(); } if (ctrlOption != null) { PersistentData <bool, bool> isShowLanguageSetup = GameMain.Singleton.BSSetting.Dat_GameShowLanguageSetup; isShowLanguageSetup.Val = !isShowLanguageSetup.Val; ctrlOption.ViewIdx = isShowLanguageSetup.Val ? 0 : 1; ctrlOption.UpdateText(); } else { Debug.LogError("ctrlOption == null"); } } } }
void SetupPsw(string pswName) { mCurWndOptioner.IsControlable = false; //����һ������� mCurNumInputer = Instantiate(Prefab_NumInputer) as Ctrl_InputNum; mCurNumInputer.Num = Defines.PswLength; mCurNumInputer.Text_Tile.text = LI_PlzEnterNewPsw.CurrentText; mCurNumInputer.Text_Tile.Commit(); mCurNumInputer.transform.parent = transform; mCurNumInputer.transform.localPosition = TsLocal_NumInputer.localPosition; ulong pswInputFirst = 0; int pswInputState = 1;//1��һ������,2�ڶ������� mCurNumInputer.EvtConfirm = (int[] digits) => { if (digits.Length == Defines.PswLength) { if (pswInputState == 1) { pswInputFirst = Ctrl_InputNum.DigitToInt(digits); mCurNumInputer.ResetDigits(); mCurNumInputer.Text_Tile.text = LI_EnterPswAgain.CurrentText; mCurNumInputer.Text_Tile.Commit(); pswInputState = 2; } else if (pswInputState == 2) { ulong pswInputSecond = Ctrl_InputNum.DigitToInt(digits);//�ڶ����������� if (pswInputFirst == pswInputSecond) { byte[] md5Psw = Cryptor.ComputeHash(System.Text.Encoding.ASCII.GetBytes(pswInputSecond.ToString())); string md5PswStr = System.Text.Encoding.ASCII.GetString(md5Psw); WritePswMD5(pswName, md5PswStr); Destroy(mCurNumInputer.gameObject); mCurNumInputer = null; mCurWndOptioner.IsControlable = true; ViewHint(LI_SetupPswSucess.CurrentText); } else//�����������벻һ�� { mCurNumInputer.ResetDigits(); mCurNumInputer.Text_Tile.text = LI_PlzEnterNewPsw.CurrentText; mCurNumInputer.Text_Tile.Commit(); pswInputState = 1; ViewHint(LI_EnteredPswNotSame.CurrentText); } } } else ViewHint(string.Format(LI_EnterNDigitPsw.CurrentText,Defines.PswLength)); }; }
/// <summary> /// �����ߺŻ���̨�� /// </summary> /// <param name="lineIdOrTableID">true:�ߺ�,false:̨��</param> /// <param name="numLen"></param> void SetupLineIDOrTableID(bool lineIdOrTableID,int numLen) { mCurWndOptioner.IsControlable = false; //����һ������� mCurNumInputer = Instantiate(Prefab_NumInputer) as Ctrl_InputNum; mCurNumInputer.Num = numLen; mCurNumInputer.Text_Tile.text = lineIdOrTableID ? LI_PlzEnterNewLineID.CurrentText: LI_PlzEnterNewTableID.CurrentText; mCurNumInputer.Text_Tile.Commit(); mCurNumInputer.transform.parent = transform; mCurNumInputer.transform.localPosition = TsLocal_NumInputer.localPosition; mCurNumInputer.EvtConfirm = (int[] digits) => { if (digits.Length == numLen) { if(lineIdOrTableID) GameMain.Singleton.BSSetting.Dat_IdLine.SetImmdiately((int)Ctrl_InputNum.DigitToInt(digits)); else GameMain.Singleton.BSSetting.Dat_IdTable.SetImmdiately((int)Ctrl_InputNum.DigitToInt(digits)); Destroy(mCurNumInputer.gameObject); mCurNumInputer = null; mCurWndOptioner.IsControlable = true; ViewHint(LI_SetupLineIdSuccess.CurrentText); UpdateView(); } else ViewHint(LI_Enter3DigitLineID.CurrentText); }; }
void SetupFormulaCode() { mCurWndOptioner.IsControlable = false; //����һ������� mCurNumInputer = Instantiate(Prefab_NumInputer) as Ctrl_InputNum; mCurNumInputer.Num = BackStageSetting.Digit_FormulaCode; mCurNumInputer.Text_Tile.text = LI_PlzEnterFormulaCode.CurrentText; mCurNumInputer.Text_Tile.Commit(); mCurNumInputer.transform.parent = transform; mCurNumInputer.transform.localPosition = TsLocal_NumInputer.localPosition; mCurNumInputer.EvtConfirm = (int[] digits) => { if (digits.Length == BackStageSetting.Digit_FormulaCode) { uint formulaCodeNew = (uint)Ctrl_InputNum.DigitToInt(digits); if (formulaCodeNew == 0) formulaCodeNew = 0xffffffff; GameMain.Singleton.BSSetting.Dat_FormulaCode.SetImmdiately(formulaCodeNew); Destroy(mCurNumInputer.gameObject); mCurNumInputer = null; mCurWndOptioner.IsControlable = true; ViewHint(LI_SetupFormulaCodeSucess.CurrentText); UpdateView(); } else ViewHint(LI_FormulaDigitNumWorng.CurrentText); }; }
void Handle_Input(int control, HpyInputKey key, bool down) { if (key == HpyInputKey.BS_Cancel && down) { if (mCurNumInputer != null) { Destroy(mCurNumInputer.gameObject); mCurNumInputer = null; mCurWndOptioner.IsControlable = true; } } else if ((key == HpyInputKey.BS_Left||key == HpyInputKey.BS_Right) && down) { if (mCurSelectIdx == 4) { Transform ts = mCurWndOptioner.transform.FindChild("option4/ctrl_��ǰ��ʾ״̬"); Ctrl_OptionText ctrlOption = null; if(ts!=null) ctrlOption = ts.GetComponent<Ctrl_OptionText>(); if (ctrlOption != null) { PersistentData<bool,bool> isShowLanguageSetup = GameMain.Singleton.BSSetting.Dat_GameShowLanguageSetup; isShowLanguageSetup.Val = !isShowLanguageSetup.Val; ctrlOption.ViewIdx = isShowLanguageSetup.Val ? 0 : 1; ctrlOption.UpdateText(); } else { Debug.LogError("ctrlOption == null"); } } } }