//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()); } } }