public void OnClick_Get() { GameApp.Instance.SoundInstance.PlaySe("button"); GameApp.Instance.GetItemsDlg.OpenGetItemsBox(AwardItemDic); GetBtn.isEnabled = false; GetBtnText.text = "已领取"; foreach (KeyValuePair <int, int> pair in AwardItemDic) { GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", pair.Key, " ", pair.Value)); } string IsGetStateKey = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_AccumulativeLogin_IsGetState"); if (PlayerPrefs.HasKey(IsGetStateKey)) { string OldState = PlayerPrefs.GetString(IsGetStateKey); OldState += StringBuilderTool.ToString("_", CurIndex); PlayerPrefs.SetString(IsGetStateKey, OldState); } else { PlayerPrefs.SetString(IsGetStateKey, CurIndex.ToString()); } }
IEnumerator RefreshAccumulativeLoginList() { string AccumulativeLoginKey = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_AccumulativeLogin"); if (!PlayerPrefs.HasKey(AccumulativeLoginKey)) { PlayerPrefs.SetString(AccumulativeLoginKey, DateTime.Now.Ticks.ToString()); } string LastTime = PlayerPrefs.GetString(AccumulativeLoginKey); DateTime dtLastTime = new DateTime(long.Parse(LastTime)); TimeSpan ResidueTime = DateTime.Now - dtLastTime; MyTools.DestroyChildNodes(AccumulativeLoginGrid.transform); UIScrollView sv = AccumulativeLoginGrid.transform.parent.GetComponent <UIScrollView>(); for (int i = 1; i <= 31; i++) { GameObject newUnit = NGUITools.AddChild(AccumulativeLoginGrid.gameObject, AccumulativeLoginUnitPrefab); newUnit.SetActive(true); newUnit.name = "AccumulativeLoginUnit_" + i; newUnit.transform.localPosition = new Vector3(0, -140 * (i - 1), 0); UI_AccumulativeLoginUnit alu = newUnit.GetComponent <UI_AccumulativeLoginUnit>(); alu.Set(i, ResidueTime.Days + 1); sv.ResetPosition(); AccumulativeLoginGrid.repositionNow = true; yield return(new WaitForEndOfFrame()); } }
void Start() { PlayerName.text = SerPlayerData.GetName(); AccountId.text = SerPlayerData.GetAccountID().ToString(); ///////////////////////////////////////////////////////////// bool isMusicMuteOn = GameApp.Instance.SoundInstance.BgmMute; MusicSwitch[0].value = !isMusicMuteOn; MusicSwitch[1].value = isMusicMuteOn; bool isSeMuteOn = GameApp.Instance.SoundInstance.SeMute; SeSwitch[0].value = !isSeMuteOn; SeSwitch[1].value = isSeMuteOn; InitPetInfo(); InvokeRepeating("RefreshPetModifBtnState", 1f, 0.2f); InitSleepSet(); InvokeRepeating("RefreshSleepModifBtnState", 1f, 0.2f); #if UNITY_EDITOR SystemSetTab.SetActive(true); #endif }
public SleepInfo() { uint AccountID = SerPlayerData.GetAccountID(); key_SleepBeginTime = StringBuilderTool.ToString(AccountID, "_PetInfo_SleepBeginTime"); key_SleepEndTime = StringBuilderTool.ToString(AccountID, "_PetInfo_key_SleepEndTime"); key_EnableUseDuration = StringBuilderTool.ToString(AccountID, "_PetInfo_EnableUseDuration"); key_RestUseDuration = StringBuilderTool.ToString(AccountID, "_PetInfo_RestUseDuration"); }
public PetInfo() { uint AccountID = SerPlayerData.GetAccountID(); key_Name = StringBuilderTool.ToString(AccountID, "_PetInfo_Name"); key_Sex = StringBuilderTool.ToString(AccountID, "_PetInfo_Sex"); key_AgeYeah = StringBuilderTool.ToString(AccountID, "_PetInfo_AgeYeah"); key_AgeMonth = StringBuilderTool.ToString(AccountID, "_PetInfo_AgeMonth"); }
/*void Update() * { * if (Input.GetKeyUp(KeyCode.A)) * { * //MyTools.SetStageProgress(0,2); * PlayerPrefs.DeleteAll(); * } * }*/ public void UpdateStageState() { switch (CurGroupIndex) { case 1: SetStageState(SerPlayerData.GetMainStageProgress() /*Const.IsStageAllOpen ? 4 : MyTools.GetStageProgress(CurIndex)*/); break; case 2: int StageProgress = 0; if (GameApp.Instance.PlayerData != null) { string key_zoo = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_Zoo_StageProgress"); if (PlayerPrefs.HasKey(key_zoo)) { StageProgress = PlayerPrefs.GetInt(key_zoo); } else { PlayerPrefs.SetInt(key_zoo, 0); } } else { StageProgress = 999; } SetStageState(StageProgress); break; case 3: SetStageState(999); break; } /*if (AllStageDotShow) * { * GameApp.Instance.SelModeUI.StageGroupLabs[CurIndex].transform.parent.Find("Bg").GetComponent<UISprite>().spriteName = "gamemode_button_normal_g"; * GameApp.Instance.SelModeUI.StageGroupLabs[CurIndex].transform.parent.Find("SelBg").gameObject.SetActive(false); * * GameObject nextBtn = transform.parent.parent.Find("Anchor_Left").Find("Mode_" + (CurIndex + 2)).gameObject; * GameApp.Instance.SelModeUI.SwitchShowStageGroup(nextBtn); * } * else * { * GameApp.Instance.SelModeUI.StageGroupLabs[CurIndex].transform.parent.Find("Bg").GetComponent<UISprite>().spriteName = "gamemode_button_normal"; * }*/ }
void Start() { GameApp.Instance.SoundInstance.PlayBgm("BGM_HomePage"); MainPlayerInfo.UseBigHeadPortrait(); MainPlayerInfo.Init(GameApp.Instance.MainPlayerData); int i = 0; foreach (KeyValuePair <int, ChapterConfig> pair in CsvConfigTables.Instance.ChapterCsvDic) { if (i < ChapterLst.Length) { ChapterLst[i].Set(pair.Value.ChapterID); i++; } } Invoke("CheckPrivilegeAward", 1f); if (GameApp.Instance.PlayerData != null) { bool NeedShowFirstChessGuide = true; string key = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_NeedShow_FirstChessGuide"); if (PlayerPrefs.HasKey(key)) { NeedShowFirstChessGuide = (PlayerPrefs.GetInt(key) == 1); } else { PlayerPrefs.SetInt(key, 1); } if (NeedShowFirstChessGuide) { GameObject FirstChessGuideObj = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs/UI/UI_FirstChessGuide")); if (FirstChessGuideObj != null) { UI_FirstChessGuide fcg = FirstChessGuideObj.GetComponent <UI_FirstChessGuide>(); if (fcg != null) { fcg.SetGuideState(0); } } } } }
public void SetGuideState(int stateIdx) { if (PetModel == null) { RoleConfig rc = null; if (CsvConfigTables.Instance.RoleCsvDic.TryGetValue((int)GameApp.Instance.MainPlayerData.PetID, out rc)) { GameObject model = Resources.Load <GameObject>(StringBuilderTool.ToString("Prefabs/Actor/", rc.ModelName)); if (model != null) { PetModel = GameObject.Instantiate(model); MyTools.setLayerDeep(PetModel, LayerMask.NameToLayer("Guide")); PetModel.transform.parent = PetRoot; PetModel.transform.localPosition = new Vector3(-110, -73, -84); PetModel.transform.localEulerAngles = new Vector3(0, -140, 0); PetModel.transform.localScale = Vector3.one * 220; PetAnim = PetModel.GetComponent <Animator>(); PetAnim.runtimeAnimatorController = PetFlyAnimCrl; } } } switch (stateIdx) { case 0: GameApp.Instance.SoundInstance.PlayVoice("0_HomePageEntrance"); PetModel.transform.localPosition = new Vector3(-110, -73, -84); PetModel.transform.localEulerAngles = new Vector3(0, -140, 0); StepObjs[0].SetActive(true); break; case 1: GameApp.Instance.SoundInstance.StopSe("0_HomePageEntrance"); GameApp.Instance.SoundInstance.PlayVoice("1_IntroToDinosaurLevel"); StepObjs[0].SetActive(false); StepObjs[1].SetActive(true); break; case 2: GameApp.Instance.SoundInstance.StopSe("1_IntroToDinosaurLevel"); GameApp.Instance.SoundInstance.PlayVoice("2_FromTriassicPeriod"); PetModel.transform.localPosition = new Vector3(111, -73, -84); StepObjs[1].SetActive(false); StepObjs[2].SetActive(true); break; case 3: GameApp.Instance.SoundInstance.StopSe("2_FromTriassicPeriod"); GameApp.Instance.SoundInstance.PlayVoice("3_CreateAdventureTeams"); StepObjs[2].SetActive(false); StepObjs[3].SetActive(true); break; case 4: GameApp.Instance.SoundInstance.StopSe("3_CreateAdventureTeams"); GameApp.Instance.SoundInstance.PlayVoice("4_CheckReward"); PetModel.transform.localPosition = new Vector3(-187, -275, -84); StepObjs[3].SetActive(false); StepObjs[4].SetActive(true); break; case 5: GameApp.Instance.SoundInstance.StopSe("4_CheckReward"); GameApp.Instance.SoundInstance.PlayVoice("5_InvitePartner"); PetModel.transform.localPosition = new Vector3(300, -112, -84); PetModel.transform.localEulerAngles = new Vector3(0, 140, 0); StepObjs[4].SetActive(false); StepObjs[5].SetActive(true); break; case 6: GameApp.Instance.SoundInstance.StopSe("5_InvitePartner"); GameApp.Instance.SoundInstance.PlayVoice("6_InvitePet"); PetModel.transform.localPosition = new Vector3(166, -69, -84); PetModel.transform.localEulerAngles = new Vector3(0, -140, 0); StepObjs[5].SetActive(false); StepObjs[6].SetActive(true); break; case 7: GameApp.Instance.SoundInstance.StopSe("6_InvitePet"); GameApp.Instance.SoundInstance.PlayVoice("7_BeganToAdventure"); PetModel.transform.localPosition = new Vector3(218, -256, -84); PetModel.transform.localEulerAngles = new Vector3(0, 140, 0); StepObjs[6].SetActive(false); StepObjs[7].SetActive(true); break; case 8: GameApp.Instance.SoundInstance.StopSe("7_BeganToAdventure"); PetModel.SetActive(false); StepObjs[7].SetActive(false); break; case 9: GameApp.Instance.SoundInstance.PlayVoice("8_Throwing"); PetModel.SetActive(true); StepObjs[8].SetActive(true); break; case 10: GameApp.Instance.SoundInstance.StopSe("8_Throwing"); StepObjs[8].SetActive(false); string key = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_NeedShow_FirstChessGuide"); PlayerPrefs.SetInt(key, 0); Destroy(gameObject); break; } }
public void RefreshResidueTime() { uint ItemCount = SerPlayerData.GetItemCount(ItemID); if (ItemCount > 0) { string des = ""; int DaySum = 0; uint AccountID = SerPlayerData.GetAccountID(); string itemKey = ""; string awardKey = ""; switch (PrivilegeType) { case EPrivilegeType.eMonth: des = "月"; DaySum = 30 * (int)ItemCount; itemKey = StringBuilderTool.ToString(AccountID, "_Privilege_Month"); awardKey = StringBuilderTool.ToString(AccountID, "_Award_Month_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); break; case EPrivilegeType.eSeason: des = "季"; DaySum = 90 * (int)ItemCount; itemKey = StringBuilderTool.ToString(AccountID, "_Privilege_Season"); awardKey = StringBuilderTool.ToString(AccountID, "_Award_Season_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); break; case EPrivilegeType.eYear: des = "年"; DaySum = 365 * (int)ItemCount; itemKey = StringBuilderTool.ToString(AccountID, "_Privilege_Year"); awardKey = StringBuilderTool.ToString(AccountID, "_Award_Year_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); break; } if (ItemCount == 1) { PlayerPrefs.SetString(itemKey, DateTime.Now.Ticks.ToString()); } string RecordFirstItemTime = PlayerPrefs.GetString(itemKey); DateTime dtFirstItemTime = new DateTime(long.Parse(RecordFirstItemTime)); TimeSpan ResidueTime = DateTime.Now - dtFirstItemTime; DaySum -= ResidueTime.Days; ResidueTimeDesLab.text = StringBuilderTool.ToString("[6BFF78]", des, "卡特权已开通[-]([FEE209]", DaySum, "[-]天)"); if (!PlayerPrefs.HasKey(awardKey)) { PlayerPrefs.SetInt(awardKey, 1); Dictionary <int, int> AwardItemDic = new Dictionary <int, int>(); switch (PrivilegeType) { case EPrivilegeType.eMonth: AwardItemDic.Add(20002, 3); AwardItemDic.Add(1001, 100); AwardItemDic.Add(1003, 100); break; case EPrivilegeType.eSeason: AwardItemDic.Add(20002, 4); AwardItemDic.Add(1001, 200); AwardItemDic.Add(1003, 200); break; case EPrivilegeType.eYear: AwardItemDic.Add(20002, 5); AwardItemDic.Add(1001, 300); AwardItemDic.Add(1003, 300); break; } foreach (KeyValuePair <int, int> pair in AwardItemDic) { GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", pair.Key, " ", pair.Value)); } GameApp.Instance.GetItemsDlg.OpenGetItemsBox(AwardItemDic); } } else { ResidueTimeDesLab.text = "[C74343]未开通[-]"; } }
void CheckPrivilegeAward() { //GameApp.Instance.RollingNoticeDlg.AddRollingNotice("欢迎试玩《魔卡百科》Demo版本!"); Dictionary <EPrivilegeType, int> PrivilegeLst = new Dictionary <EPrivilegeType, int>(); PrivilegeLst.Add(EPrivilegeType.eMonth, 2001); PrivilegeLst.Add(EPrivilegeType.eSeason, 2002); PrivilegeLst.Add(EPrivilegeType.eYear, 2003); foreach (KeyValuePair <EPrivilegeType, int> pair in PrivilegeLst) { uint ItemCount = SerPlayerData.GetItemCount(pair.Value); if (ItemCount > 0) { string des = ""; uint AccountID = SerPlayerData.GetAccountID(); string awardKey = ""; switch (pair.Key) { case EPrivilegeType.eMonth: des = "月"; awardKey = StringBuilderTool.ToString(AccountID, "_Award_Month_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); break; case EPrivilegeType.eSeason: des = "季"; awardKey = StringBuilderTool.ToString(AccountID, "_Award_Season_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); break; case EPrivilegeType.eYear: des = "年"; awardKey = StringBuilderTool.ToString(AccountID, "_Award_Year_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); break; } if (!PlayerPrefs.HasKey(awardKey)) { PlayerPrefs.SetInt(awardKey, 1); Dictionary <int, int> AwardItemDic = new Dictionary <int, int>(); switch (pair.Key) { case EPrivilegeType.eMonth: AwardItemDic.Add(20002, 3); AwardItemDic.Add(1001, 100); AwardItemDic.Add(1003, 100); break; case EPrivilegeType.eSeason: AwardItemDic.Add(20002, 4); AwardItemDic.Add(1001, 200); AwardItemDic.Add(1003, 200); break; case EPrivilegeType.eYear: AwardItemDic.Add(20002, 5); AwardItemDic.Add(1001, 300); AwardItemDic.Add(1003, 300); break; } foreach (KeyValuePair <int, int> pair2 in AwardItemDic) { GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", pair2.Key, " ", pair2.Value)); } GameApp.Instance.GetItemsDlg.OpenGetItemsBox(AwardItemDic); GameApp.Instance.CommonHintDlg.OpenHintBox(StringBuilderTool.ToInfoString(des, "卡特权每日奖励!")); } } } }
public void Set(int Index, int CurAL) { CurIndex = Index; Title.text = StringBuilderTool.ToString("累计登录", Index, "天"); Schedule.text = StringBuilderTool.ToString(CurAL, "/", Index); bool IsGet = false; string StateStr = ""; string IsGetStateKey = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_AccumulativeLogin_IsGetState"); if (PlayerPrefs.HasKey(IsGetStateKey)) { StateStr = PlayerPrefs.GetString(IsGetStateKey); string[] tempSplit = StateStr.Split('_'); for (int k = 0; k < tempSplit.Length; k++) { if (int.Parse(tempSplit[k]) == CurIndex) { IsGet = true; break; } } } if (CurAL - Index == 1 || (CurAL == Index && Index == 1)) { if (IsGet) { GetBtn.isEnabled = false; GetBtnText.text = "已领取"; } else { GetBtn.isEnabled = true; GetBtnText.text = "领取"; } } else { if (IsGet) { GetBtn.isEnabled = false; GetBtnText.text = "已领取"; } else { GetBtn.isEnabled = false; GetBtnText.text = "未完成"; } } for (int k = 0; k < AwardItemRoot.Length; k++) { AwardItemRoot[k].SetActive(false); } ActivityConfig ACfg = null; CsvConfigTables.Instance.ActivityCsvDic.TryGetValue(Index, out ACfg); if (ACfg != null) { int i = 0; AwardItemDic = ACfg.GetAward(); foreach (KeyValuePair <int, int> pair in AwardItemDic) { if (i < AwardItemIcon.Length) { AwardItemRoot[i].SetActive(true); ItemConfig ItemCfg = null; CsvConfigTables.Instance.ItemCsvDic.TryGetValue(pair.Key, out ItemCfg); if (ItemCfg != null) { if (ItemCfg.Type == 2) { AwardItemIcon[i].enabled = false; UITexture cardIcon = AwardItemIcon[i].gameObject.AddComponent <UITexture>(); cardIcon.mainTexture = Resources.Load(StringBuilderTool.ToInfoString("MagicCard/", ItemCfg.GetIcon())) as Texture; cardIcon.width = 40; cardIcon.height = 60; cardIcon.depth = 14; } else { AwardItemIcon[i].spriteName = ItemCfg.Icon; } } //AwardItemDic[pair.Key] = pair.Value * Index; AwardItemCnt[i].text = pair.Value.ToString(); } i++; } } }
private string GetLocalSaveKey() { return(StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_Achievement_", AchievementID)); }