IEnumerator Click_NextStepDelayCoroutine(float delay) { Debug.Log("Click_NextStepDelayCoroutine "); yield return(new WaitForSecondsRealtime(delay)); Click_NextStep(); }
public void Skip() { Debug.Log("Tutorial Skip !!"); StopAllCoroutines(); stepCount = 15; Step(); }
IEnumerator LoginCoroutine(bool isLogin) { while (string.IsNullOrEmpty(GetTokens())) { yield return(null); } string token = GetTokens(); string guid = SystemInfo.deviceUniqueIdentifier; string appid = Application.identifier; string currentVersion = Application.version; string os = SystemInfo.operatingSystem; string osVersion = os; #if UNITY_ANDROID osVersion = os.Replace("Android OS ", string.Empty); #elif UNITY_IOS osVersion = os.Replace("iPhone OS ", string.Empty); #endif string device = SystemInfo.deviceUniqueIdentifier; string country = Application.systemLanguage.ToString(); //UserInfoManager.Get().GetUserInfo().SetPlatformID(token); Debug.Log($"Login Success!\nID: {Social.localUser.id}\nGameID: {Social.localUser.gameId}\nName: {Social.localUser.userName}\nToken: {token}"); if (isLogin) { NetworkManager.session.AccountTemplate.AccountLoginReq(NetworkManager.session.HttpClient, token, (int)type, guid, string.Empty, appid, currentVersion, os, osVersion, device, country, GameStateManager.Get().OnReceiveAccountLoginAck); } else { NetworkManager.session.AccountTemplate.AccountPlatformLinkReq(NetworkManager.session.HttpClient, token, (int)type, isConfirm, platformLinkCallback); } }
public void Click_NextStep() { CancelInvoke("TimeStop"); Time.timeScale = 1f; Click_NextStepCallback(); stepCount++; Debug.Log($"Click_NextStep {stepCount} "); }
public void Initialize(MailInfo info) { this.info = info; TDataMailInfo data; if (TableManager.Get().MailInfo.GetData(info.mailTableId, out data)) { string countryCode = "EN"; switch (ObscuredPrefs.GetString("CountryCode", "EN")) { case "KO": countryCode = "kr"; break; default: countryCode = "en"; break; } string sender = $"mailSender_{countryCode}"; string title = $"mailTitle_{countryCode}"; string text = $"mailText_{countryCode}"; Debug.Log("======= Mail info ======"); //foreach (var member in data.GetType().GetProperty(sender).GetValue(data)) { text_From.text = $"From: {data.GetType().GetProperty(sender)?.GetValue(data)}"; text_Title.text = data.GetType().GetProperty(title)?.GetValue(data).ToString(); } // Item setting if (info.mailItems != null && info.mailItems.Length > 0) { int id = info.mailItems[0].ItemId; int value = info.mailItems[0].Value; TDataItemList itemData; if (TableManager.Get().ItemList.GetData(id, out itemData)) { image_ItemIcon.sprite = FileHelper.GetIcon(itemData.itemIcon); text_ItemCount.text = $"x{value}"; } else { btn_Item.gameObject.SetActive(false); } } else { btn_Item.gameObject.SetActive(false); } } else { Destroy(gameObject); } }
public void Initialize(int ranking) { Debug.Log($"Ranking:{ranking}"); int dicCount = TableManager.Get().RankingReward.Keys.Count; //TDataRankingReward data = new TDataRankingReward(); // for (int i = 1; i <= dicCount; i++) // { // TableManager.Get().RankingReward.GetData(i, out data); // Debug.Log($"data min:{data.rankMin}, max:{data.rankMax}"); // } }
public void Logout() { if (Social.localUser.authenticated) // 로그인 되어 있다면 { #if UNITY_ANDROID ((PlayGamesPlatform)Social.Active).SignOut(); #elif UNITY_IOS #endif } UserInfoManager.Get().GetUserInfo().SetPlatformID(string.Empty); ObscuredPrefs.SetInt("PlatformType", (int)EPlatformType.None); Debug.Log("GPGS Logout !"); }
public bool OnReceiveSeasonRankAck(ERandomwarsSeasonErrorCode errorCode, int pageNo, MsgRankInfo[] arrayRankInfo) { Invoke("RankCallingFalse", 1f); UI_Main.Get().obj_IndicatorPopup.SetActive(false); if (errorCode == ERandomwarsSeasonErrorCode.Success && arrayRankInfo != null) { Debug.Log($"Msg error code: {errorCode}"); Debug.Log($"MsgGetRankAck errorCode:{errorCode} count:{arrayRankInfo.Length}"); AddSlots(arrayRankInfo); } return(true); }
private void SetBoxs() { int count = UserInfoManager.Get().GetUserInfo().dicBox.Count; Debug.Log("Box Count: " + count); foreach (var boxData in UserInfoManager.Get().GetUserInfo().dicBox) { var obj = Instantiate(pref_BoxSlot, rts_Grid); var box = obj.GetComponent <UI_Box_Slot>(); var id = boxData.Key; var subCount = boxData.Value; box.Initialize(id, subCount); } LayoutRebuilder.ForceRebuildLayoutImmediate(rts_Grid); }
private bool MailBoxInfoAck(GameBaseMailBoxErrorCode errorCode, MailInfo[] arrayMailInfo) { UI_Main.Get().obj_IndicatorPopup.SetActive(false); if (errorCode == GameBaseMailBoxErrorCode.Success && arrayMailInfo != null) { Debug.Log($"Mail Count : {arrayMailInfo.Length}"); UpdateMailbox(arrayMailInfo); RefreshSlots(); return(true); } Debug.Log("Can't get mail info."); Close(); return(false); }
public string GetTokens() { if (Social.localUser.authenticated) { #if UNITY_ANDROID return(PlayGamesPlatform.Instance.GetIdToken()); #elif UNITY_IOS return(Social.localUser.id); #else return(null); #endif } else { Debug.Log("Not logined!"); return(null); } }
public void Login() { if (!Social.localUser.authenticated) // 로그인 되어 있지 않다면 { Social.localUser.Authenticate((bool success, string error) => // 로그인 시도 { UI_Start.Get().btn_GuestAccount.gameObject.SetActive(false); UI_Start.Get().btn_GooglePlay.gameObject.SetActive(false); UI_Start.Get().btn_GameCenter.gameObject.SetActive(false); if (success) // 성공하면 { #if UNITY_EDITOR type = EPlatformType.Guest; #elif UNITY_ANDROID type = EPlatformType.Android; #elif UNITY_IOS type = EPlatformType.IOS; #endif StartCoroutine(LoginCoroutine(true)); } else // 실패하면 { Debug.Log("Login Error : " + error); UI_Start.Get().btn_GuestAccount.gameObject.SetActive(true); #if UNITY_ANDROID UI_Start.Get().btn_GooglePlay.gameObject.SetActive(true); #elif UNITY_IOS UI_Start.Get().btn_GameCenter.gameObject.SetActive(true); #endif } }); } else { UI_Start.Get().btn_GuestAccount.gameObject.SetActive(false); UI_Start.Get().btn_GooglePlay.gameObject.SetActive(false); UI_Start.Get().btn_GameCenter.gameObject.SetActive(false); StartCoroutine(LoginCoroutine(true)); } }
public void Initialize(int rank, int trophy, string name, int nClass, int[] deck) { Debug.Log($"Rank slot initialize: rank[{rank}], trophy[{trophy}], name[{name}], class[{nClass}], deck[{string.Join(",", deck)}]"); //image_Rank.sprite = arrSprite_Rank[Mathf.Clamp(rank - 1, 0, 3)]; if (trophy >= 0) { text_Rank.text = rank.ToString(); text_Trophy.text = trophy.ToString(); text_Name.text = name; text_Class.text = $"{Global.g_class} {nClass.ToString()}"; } else { text_Trophy.text = string.Empty; text_Name.text = string.Empty; text_Class.text = string.Empty; } winlose.Initialize(deck[5], deck, name, trophy); }
public void InitializeTrophy() { listTrophySlot.Clear(); int myTrophy = UserInfoManager.Get().GetUserInfo().trophy; text_MyTrophy.text = myTrophy.ToString(); int totalSlotCount = TableManager.Get().ClassReward.Keys.Count; UI_TrophyRewardSlot.getNormalRow = UserInfoManager.Get().GetUserInfo().trophyRewardIds[0]; UI_TrophyRewardSlot.getVipRow = UserInfoManager.Get().GetUserInfo().trophyRewardIds[1]; Debug.Log($"GetTrophyReward : vip{UI_TrophyRewardSlot.getVipRow} : normal{UI_TrophyRewardSlot.getNormalRow}"); for (int i = 1; i <= totalSlotCount; i++) { var obj = Instantiate(pref_TrophyRewardSlot, Vector3.zero, Quaternion.identity, ts_TrophyContent); var slot = obj.GetComponent <UI_TrophyRewardSlot>(); slot.Initialize(i); if (i == 1) { slot.SetSplitLine(true, false, false); } else if (i == totalSlotCount) { slot.SetSplitLine(false, false, true); } var child = obj.transform.GetChild(0).gameObject; listTrophySlot.Add(child); child.SetActive(i <= 5); } trophySlotHeight = ((RectTransform)listTrophySlot[0].transform.parent).sizeDelta.y; var empty = Instantiate(pref_TrophyRewardSlot, Vector3.zero, Quaternion.identity, ts_TrophyContent); empty.transform.GetChild(0).gameObject.SetActive(false); }
public void LinkPlatform(bool isConfirm, GameBaseAccountProtocol.ReceiveAccountPlatformLinkAckDelegate callback) { this.isConfirm = isConfirm; platformLinkCallback = callback; if (!Social.localUser.authenticated) // 로그인 되어 있지 않다면 { Social.localUser.Authenticate((bool success, string error) => // 로그인 시도 { if (success) // 성공하면 { #if UNITY_EDITOR type = EPlatformType.Guest; #elif UNITY_ANDROID type = EPlatformType.Android; #elif UNITY_IOS type = EPlatformType.IOS; #endif StartCoroutine(LoginCoroutine(false)); } else // 실패하면 { Debug.Log("Login Error : " + error); } }); } else { #if UNITY_EDITOR type = EPlatformType.Guest; #elif UNITY_ANDROID type = EPlatformType.Android; #elif UNITY_IOS type = EPlatformType.IOS; #endif StartCoroutine(LoginCoroutine(false)); } }
public bool OnReceiveSeasonInfoAck(ERandomwarsSeasonErrorCode errorCode, UserSeasonInfo seasonInfo, MsgRankInfo[] arrayRankInfo) { Invoke("RankCallingFalse", 1f); StopAllCoroutines(); UI_Main.Get().obj_IndicatorPopup.SetActive(false); if (seasonInfo.NeedSeasonReset) { //UI_Main.Get().seasonEndPopup.Initialize(); UI_Main.Get().ShowMessageBox("시즌 종료", "시즌이 종료되었습니다.", UI_Main.Get().seasonEndPopup.Initialize); Close(); } Debug.Log($"UserSeasonInfoAck {seasonInfo.SeasonId} state {(SEASON_STATE)seasonInfo.SeasonState}, remainTime {seasonInfo.SeasonResetRemainTime}, needReset {seasonInfo.NeedSeasonReset}\n" + $"MyRank:{seasonInfo.Rank}, MyTrophy:{seasonInfo.SeasonTrophy}, Time:{seasonInfo.SeasonResetRemainTime}"); ResetSlots(); switch ((SEASON_STATE)seasonInfo.SeasonState) { case SEASON_STATE.NONE: text_RankMessage.gameObject.SetActive(true); break; //case SEASON_STATE.PRE: // text_RankMessage.gameObject.SetActive(true); // break; case SEASON_STATE.GOING: isInitialized = true; text_RankMessage.gameObject.SetActive(false); text_Season.text = $"SEASON {seasonInfo.SeasonId}"; //text_SeasonRemainTime.text = msg.SeasonRemainTime.ToString(); //StartCoroutine(TimerCoroutine(msg.SeasonRemainTime)); //time = DateTime.Now.AddSeconds(msg.SeasonRemainTime); text_MyRanking.text = seasonInfo.Rank > 0 ? seasonInfo.Rank.ToString() : string.Empty; text_MyTrophy.text = seasonInfo.SeasonTrophy.ToString(); Debug.Log($"RankInfoCount: {arrayRankInfo.Length}"); AddSlots(arrayRankInfo); // for (int i = 0; i < listSlot.Count && i < msg.TopRankInfo.Length; i++) // { // listSlot[i].Initialize( // msg.TopRankInfo[i].Ranking, // msg.TopRankInfo[i].Trophy, // msg.TopRankInfo[i].Name, // msg.TopRankInfo[i].Class, // msg.TopRankInfo[i].DeckInfo // ); // } break; case SEASON_STATE.BREAK: text_RankMessage.gameObject.SetActive(true); break; case SEASON_STATE.END: text_RankMessage.gameObject.SetActive(true); break; } Open(); return(true); }
private void Step() { Debug.Log("Tutorial step : " + stepCount); image_NextStep.DOFade(0.78f, 0).SetUpdate(true); for (int i = 1; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(i == stepCount + 1); } var server = FindObjectOfType <RWNetworkServer>(); switch (stepCount) { case 0: //transform.GetChild(stepCount + 1).GetComponent<Button>().interactable = true; break; case 1: { var btn = ts_BattleButton.GetComponent <Button>(); transform.GetChild(stepCount + 1).GetComponent <Button>().interactable = false; ts_OldParent = ts_BattleButton.parent; ts_BattleButton.parent = transform.GetChild(stepCount + 1); btn.onClick = new Button.ButtonClickedEvent(); btn.onClick.AddListener(Click_NextStep); btn.onClick.AddListener(MoveScene); btn.onClick.AddListener(btn.GetComponent <AudioPlay>().Play); } break; case 2: if (SceneManager.GetActiveScene().buildIndex == 1) { Debug.Log("Outgame tutorial end"); image_NextStep.DOFade(0f, 0f); var btn_Battle = ts_BattleButton.GetComponent <Button>(); btn_Battle.onClick.RemoveListener(Click_NextStep); var images = ts_BattleButton.GetComponentsInChildren <Image>(); foreach (var image in images) { image.DOFade(0f, 0.25f); } var texts = ts_BattleButton.GetComponentsInChildren <Text>(); foreach (var text in texts) { text.DOFade(0f, 0.25f); } ts_BattleButton.parent = ts_OldParent; } else { Invoke("TimeStop", 1f); image_NextStep.DOFade(0f, 0).SetUpdate(true); transform.GetChild(stepCount + 1).GetChild(0).gameObject.SetActive(true); Debug.Log("Ingame tutorial"); } break; case 3: Time.timeScale = 0.0f; server.serverGameLogic._gameMode.PlayerState1.sp += 110; server.serverGameLogic._gameMode.PlayerState2.sp += 1000; server.serverGameLogic._gameMode.PlayerState2.GetDice(3, 1); server.serverGameLogic._gameMode.PlayerState2.GetDice(1, 2); server.serverGameLogic._gameMode.PlayerState2.GetDice(3, 3); server.serverGameLogic._gameMode.PlayerState2.GetDice(2, 5); server.serverGameLogic._gameMode.PlayerState2.GetDice(4, 7); server.serverGameLogic._gameMode.PlayerState2.GetDice(2, 9); server.serverGameLogic._gameMode.PlayerState2.GetDice(0, 11); server.serverGameLogic._gameMode.PlayerState2.GetDice(0, 13); break; case 4: // 주사위 소환 버튼 Time.timeScale = 0.0f; transform.GetChild(stepCount + 1).GetComponent <Button>().interactable = false; ts_OldParent = ts_GetDiceButton.parent; ts_GetDiceButton.parent = transform.GetChild(stepCount + 1); ts_GetDiceButton.GetComponent <Button>().onClick.AddListener(GetDice); break; case 5: Time.timeScale = 0.0f; break; case 6: Time.timeScale = 0.0f; break; case 7: Time.timeScale = 0.0f; server.serverGameLogic._gameMode.PlayerState1.sp += 5000; break; case 8: // 두번째 주사위 소환 Time.timeScale = 0.0f; transform.GetChild(stepCount + 1).GetComponent <Button>().interactable = false; ts_OldParent = ts_GetDiceButton.parent; ts_GetDiceButton.parent = transform.GetChild(stepCount + 1); ts_GetDiceButton.GetComponent <Button>().onClick.AddListener(GetDice); break; case 9: Time.timeScale = 0.0f; transform.GetChild(stepCount + 1).GetComponent <Button>().interactable = false; ts_OldParent = ts_DiceField.parent; ts_DiceField.parent = transform.GetChild(stepCount + 1); break; case 10: Time.timeScale = 1f; image_NextStep.DOFade(0, 0).SetUpdate(true); image_NextStep.raycastTarget = true; ts_DiceField.parent = ts_OldParent; Click_NextStepDelay(3f); break; case 11: UI_DiceField.Get().BroadcastMessage("AttachIcon"); image_NextStep.raycastTarget = true; Time.timeScale = 0.0f; ts_OldParent = ts_UpgradeButton.parent; ts_UpgradeButton.parent = transform.GetChild(stepCount + 1); ts_UpgradeButton.GetComponent <Button>().onClick.AddListener(Click_NextStep); break; case 12: Time.timeScale = 1f; image_NextStep.DOFade(0, 0).SetUpdate(true); image_NextStep.raycastTarget = false; ts_UpgradeButton.GetComponent <Button>().onClick.RemoveListener(Click_NextStep); ts_UpgradeButton.parent = ts_OldParent; break; case 13: Time.timeScale = 1f; image_NextStep.raycastTarget = false; image_NextStep.DOFade(0, 0).SetUpdate(true); break; case 14: Time.timeScale = 1f; break; default: image_NextStep.DOFade(0, 0).SetUpdate(true); image_NextStep.raycastTarget = false; Time.timeScale = 1f; UserInfoManager.Get().GetUserInfo().isEndTutorial = true; NetworkManager.session.UserTemplate.UserTutorialEndReq(NetworkManager.session.HttpClient, OnEndTutorial); isTutorial = false; //NetworkManager.Get().EndTutorialReq(UserInfoManager.Get().GetUserInfo().userID); break; } }
public void Initialize(int id, COST_TYPE costType, int cost) { Debug.Log($"BOX ID:{id}"); this.boxID = id; this.costType = costType; this.cost = cost; RandomWarsResource.Data.TDataItemList dataBoxList; if (TableManager.Get().ItemList.GetData(id, out dataBoxList) == false) { return; } int totalGold = 0; int totalDiamond = 0; int totalDiceCount = 0; foreach (var productId in dataBoxList.productId) { RandomWarsResource.Data.TDataBoxOpenInfo dataBoxProductInfo; if (TableManager.Get().BoxProductInfo.GetData(productId, out dataBoxProductInfo) == false) { return; } // TODO : [개선] 우선 최소값만 합산함. totalGold += dataBoxProductInfo.itemValue01[0]; totalDiamond += dataBoxProductInfo.itemValue02[0] == -1 ? 0 : dataBoxProductInfo.itemValue02[0]; if (dataBoxProductInfo.rewardCardGradeType1 != 0) { totalDiceCount += dataBoxProductInfo.rewardCardValue1[0]; } if (dataBoxProductInfo.rewardCardGradeType2 != 0) { totalDiceCount += dataBoxProductInfo.rewardCardValue2[0]; } if (dataBoxProductInfo.rewardCardGradeType3 != 0) { totalDiceCount += dataBoxProductInfo.rewardCardValue3[0]; } if (dataBoxProductInfo.rewardCardGradeType4 != 0) { totalDiceCount += dataBoxProductInfo.rewardCardValue4[0]; } if (dataBoxProductInfo.rewardCardGradeType5 != 0) { totalDiceCount += dataBoxProductInfo.rewardCardValue5[0]; } } text_BoxName.text = LocalizationManager.GetLangDesc(dataBoxList.itemName_langId); // Gold obj_Gold.SetActive(totalGold > 0); if (obj_Gold.activeSelf) { text_Gold.text = totalGold.ToString(); } // Total Dice obj_Dice.SetActive(totalDiceCount > 0); if (totalDiceCount > 0) { text_Dice.text = $"x{totalDiceCount}"; } // Diamond obj_Diamond.SetActive(totalDiamond > 0); if (obj_Diamond.activeSelf) { text_Diamond.text = totalDiamond.ToString(); } image_CostIcon.sprite = arrSprite_CostType[(int)costType]; text_Cost.text = cost.ToString(); obj_BoxOpenParticle.SetActive(false); openCount = 0; RectTransform rts = ((RectTransform)ani_Box.transform); rts.DOAnchorPosY(400f, 0); rts.DOScale(1f, 0); image_Blind.gameObject.SetActive(false); image_Blind.raycastTarget = false; image_Blind.DOFade(0, 0); image_Pattern.DOFade(0, 0); ani_Item.gameObject.SetActive(false); switch ((RandomWarsResource.Data.EItemListKey)id) { case RandomWarsResource.Data.EItemListKey.boss01box: case RandomWarsResource.Data.EItemListKey.boss02box: case RandomWarsResource.Data.EItemListKey.boss03box: case RandomWarsResource.Data.EItemListKey.boss04box: case RandomWarsResource.Data.EItemListKey.boss05box: ani_Box.runtimeAnimatorController = arrAniController_Box[1]; SoundManager.instance.Play(Global.E_SOUND.SFX_UI_BOX_COOP_APPEAR); break; default: ani_Box.runtimeAnimatorController = arrAniController_Box[0]; SoundManager.instance.Play(Global.E_SOUND.SFX_UI_BOX_NORMAL_APPEAR); break; } //ani_Box.runtimeAnimatorController = arrAniController_Box[id - (int)RandomWarsResource.Data.EItemListKey.boss01box]; ani_Box.gameObject.SetActive(true); obj_Result.SetActive(false); }