/// <summary> /// Start /// </summary> private void Start() { this.stateManager.AddState(new NoneState { scene = this }); this.stateManager.AddState(new ConnectState { scene = this }); this.stateManager.AddState(new GetLobyInfoState { scene = this }); this.stateManager.AddState(new LobbyState { scene = this }); //プレイ可能なワールドの情報を通信取得 MultiPlayApi.CallTopApi((response) => { this.response = response; //ロビー情報仮作成 this.lobbyInfos = response.tMultiWorld .Where(x => x.worldStatus >= 0) .Select(x => new LobbyInfo { worldId = x.multiWorldId }) .ToArray(); // ChangeState var state = this.stateManager.GetState <ConnectState>(); state.nextStateName = typeof(GetLobyInfoState).Name; this.stateManager.ChangeState <ConnectState>(); }); }
/// <summary> /// 決定ボタンクリック時 /// </summary> private void OnClickDecideButton() { if (!this.dialog.isClose) { if (this.product is ProductBilling) { var iap = (SceneChanger.currentScene as ShopScene).iap; //処理完了までタッチブロック SharedUI.Instance.DisableTouch(); //一次通貨による商品の購入を行う iap.Purchase( productId: Masters.BillingDB.FindById(this.product.master.id).productId, onSuccess: (userBillingData) => { //タッチブロック解除 SharedUI.Instance.EnableTouch(); this.CloseDialog(); this.onPurchaseCompleted?.Invoke(userBillingData, null, this.icon, this.product); }, onFailed: () => { //タッチブロック解除 SharedUI.Instance.EnableTouch(); }); } else if (SceneChanger.currentScene is Battle.MultiBattleScene) { //バトル中簡易ショップの場合の購入通信 MultiPlayApi.CallItemBuyApi( this.product.master.id, this.buyNum, (SceneChanger.currentScene as Battle.MultiBattleScene).logData, (userShop) => { this.CloseDialog(); this.onPurchaseCompleted?.Invoke(null, userShop, this.icon, this.product); }); } else { //ジェム・コインなどの二次通貨による商品の購入を行う ShopApi.CallBuyApi( this.product.master.id, this.buyNum, (userShop) => { CloseDialog(); this.onPurchaseCompleted?.Invoke(null, userShop, this.icon, this.product); }); } SoundManager.Instance.PlaySe(SeName.YES); } }
/// <summary> /// 開く /// </summary> public static void Open(MultiPlayApi.LogData logData, UILevelUp prefab, RectTransform parent, Action onClose) { //API実行 MultiPlayApi.CallLevelUpApi(logData, (response) => { //レベルアップ前後の値 //uint beforeLevel = UserData.Get().lv; uint afterLevel = response.tUsers.level; UserData.Get().lv = afterLevel; //ローダー var loader = new AssetListLoader(); if (response.mLevelReward != null) { //汎用スプライトじゃなければローダーに積む loader.AddRange(response.mLevelReward .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId)) .Where(x => !x.IsCommonSprite()) .Select(x => new AssetLoader <Sprite>(x.GetSpritePath()))); //報酬付与 foreach (var reward in response.mLevelReward) { UserData.Get().AddItem((ItemType)reward.itemType, reward.itemId, reward.itemNum); } } //ロード中のタッチブロック SharedUI.Instance.DisableTouch(); //ロード開始 loader.Load(() => { //タッチブロック解除 SharedUI.Instance.EnableTouch(); //レベルアップダイアログ開く var dialog = Instantiate(prefab, parent, false); dialog.Setup(response, loader, onClose); }); }); }