コード例 #1
0
ファイル: ShopApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// 購入履歴の取得
    /// </summary>
    public static void CallBuyStatusApi(uint shopId, Action <List <UserShopData> > onCompleted)
    {
        //リクエスト作成
        var request = new SharkWebRequest <BuyStatusResponseData>("shop/buyStatus");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        //リクエストパラメータセット
        if (shopId > 0)
        {
            //shopIdの指定がない場合は全件取得
            request.SetRequestParameter(new Dictionary <string, object>
            {
                { "shopId", shopId }
            });
        }

        //通信完了時コールバック登録
        request.onSuccess = (response) =>
        {
            //通信完了
            onCompleted?.Invoke(response.tShop);
        };

        //通信開始
        request.Send();
    }
コード例 #2
0
    /// <summary>
    /// パーツからギアの取り外し通信
    /// </summary>
    public static void CallGearUnsetApi(uint gearServerId, Action onCompleted)
    {
        //対象ギアの取得
        UserGearData userGear = UserData.Get().gearData.First(gear => gear.serverId == gearServerId);

#if SHARK_OFFLINE
        userGear.SetPartsServerId(null, DateTime.Now);
        onCompleted?.Invoke();
        return;
#endif
        var request = new SharkWebRequest <CannonGearUnsetResponseData>("cannon/gearUnset");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "gearId", gearServerId },
        });

        request.onSuccess = (response) =>
        {
            //コイン消費の反映
            UserData.Get().Set(response.tUsers);
            SharedUI.Instance.header.SetInfo(UserData.Get());

            //ギア取り外しの反映
            userGear.SetPartsServerId(null, response.tGear.setDateTime);
            // 無理、ギア外すカウンター更新
            CustomGearConfirmDialogContent.freeGearRemoveCount = response.freeRemoveCount;

            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #3
0
ファイル: ShopApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// ショップ関連のデータ取得通信
    /// </summary>
    public static void CallNowShopApi(Action <List <UserShopData> > onCompleted)
    {
#if SHARK_OFFLINE
        CoroutineUpdator.Create(null, () => onCompleted?.Invoke(new List <UserShopData>()));
        return;
#endif
        //リクエスト作成
        var request = new SharkWebRequest <NowShopResponseData>("shop/nowShop");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        //通信完了時コールバック登録
        request.onSuccess = (response) =>
        {
            var jArray = new JArray(response.mShopItem.SelectMany(x => x).ToArray());
            Masters.ShopDB.SetList(response.mShop.ToString());
            Masters.ShopGroupDB.SetList(response.mShopGroup.ToString());
            Masters.ShopItemDB.SetList(jArray.ToString());

            //通信完了
            onCompleted?.Invoke(response.tShop);
        };

        //通信開始
        request.Send();
    }
コード例 #4
0
ファイル: BillingApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// 有償石の商品リストの取得
    /// </summary>
    public static void CallListApi(Action onCompleted)
    {
#if SHARK_OFFLINE
        CoroutineUpdator.Create(null, () =>
        {
            Masters.BillingDB.GetList().RemoveAll(x => x.platform != SharkDefine.DEVICE_TYPE);
            onCompleted?.Invoke();
        });
        return;
#endif
        //リクエスト作成
        var request = new SharkWebRequest <Dictionary <string, object> >("billing/list");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        //通信完了時コールバック登録
        request.onSuccess = (response) =>
        {
            //商品リスト更新
            Masters.BillingDB.SetList(response[Masters.BillingDB.tableName].ToString());
            Masters.BillingGroupDB.SetList(response[Masters.BillingGroupDB.tableName].ToString());
            Masters.BillingItemDB.SetList(response[Masters.BillingItemDB.tableName].ToString());

            //通信完了
            onCompleted?.Invoke();
        };

        //通信開始
        request.Send();
    }
コード例 #5
0
    /// <summary>
    /// パーツへのギア装着通信
    /// </summary>
    public static void CallGearSetApi(uint gearServerId, uint partsServerId, Action onCompleted)
    {
        //対象ギアの取得
        UserGearData userGear = UserData.Get().gearData.First(gear => gear.serverId == gearServerId);

#if SHARK_OFFLINE
        userGear.SetPartsServerId(partsServerId, DateTime.Now);
        onCompleted?.Invoke();
        return;
#endif
        var request = new SharkWebRequest <CannonGearSetResponseData>("cannon/gearSet");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "gearId", gearServerId },
            { "cannonId", partsServerId },
        });

        request.onSuccess = (response) =>
        {
            //ギア装着の反映
            userGear.SetPartsServerId(partsServerId, response.tGear.setDateTime);

            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #6
0
    /// <summary>
    /// 所持砲台、パーツ情報の取得通信
    /// </summary>
    public static void CallUserApi(Action onCompleted)
    {
        if (!isNeedRefleshCannonUser)
        {
            onCompleted?.Invoke();
            return;
        }
#if SHARK_OFFLINE
        var request = new SharkWebRequest <FirstApi.FirstUserResponseData>("first/user");
#else
        var request = new SharkWebRequest <FirstApi.FirstUserResponseData>("cannon/user");
#endif

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.onSuccess = (response) =>
        {
            UserData.Get().SetTurretData(
                response.tCannonSetting,
                response.tCannonBattery,
                response.tCannonBarrel,
                response.tCannonBullet,
                response.tCannonAccessories,
                response.tGear
                );

            isNeedRefleshCannonUser = false;

            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #7
0
ファイル: HomeApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// Home情報取得通信
    /// </summary>
    public static void CallHomeDataApi(Action <HomeDataResponse> onCompleted)
    {
        var request = new SharkWebRequest <HomeDataResponse>("home/homeData");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.onSuccess = (response) =>
        {
            //無期限BOXの上限超過してるかどうか
            HomeScene.isMaxPossession = response.isMaxPossession;

            if (response.loginBonusChk)
            {
                //通常ログボのアイテム付与
                var master = Masters.LoginBonusDB.FindById(response.tLoginBonus.loginBonusId);
                UserData.Get().AddItem((ItemType)master.itemType, master.itemId, master.itemNum);
            }

            if (response.specialLoginBonusChk)
            {
                //スペシャルログボのアイテム付与
                var master = Masters.LoginBonusSpecialDB.FindById(response.tLoginBonusSpecial.loginBonusId);
                UserData.Get().AddItem((ItemType)master.itemType, master.itemId, master.itemNum);
            }

            //ヘッダー更新
            SharedUI.Instance.header.SetInfo(UserData.Get());
            // 無理、ギア外すカウンター取得
            CustomGearConfirmDialogContent.freeGearRemoveCount = response.freeRemoveCount;

            onCompleted?.Invoke(response);
        };

        request.Send();
    }
コード例 #8
0
    /// <summary>
    /// ユーザー作成通信
    /// </summary>
    public static void CallCreateApi(string userName, Action onCompleted)
    {
        //リクエスト作成
        var request = new SharkWebRequest <CreateResponseData>("user/create");

        //リクエストパラメータセット
        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "userName", userName },
            { "authType", 3 },
            { "deviceType", SharkDefine.DEVICE_TYPE },
        });

        //通信完了時コールバック登録
        request.onSuccess = (response) =>
        {
            //id,hash,passwordが揃った段階で一旦端末に保存する
            response.userData.password = response.password;
            response.userData.Save();

            //ユーザーデータセット
            response.userData.Set(response.tUsers);
            UserData.Set(response.userData);

            //通信完了
            onCompleted?.Invoke();
        };

        //通信開始
        request.Send();
    }
コード例 #9
0
    /// <summary>
    /// 引継ぎコード入力後ユーザーID・PASS取得通信
    /// </summary>
    public static void CallDeviceChangeCode(
        string takeOverId,
        string takeOverPass,
        Action <DeviceChangeCodeResponseData> onCompleted,
        Action <int> onError)
    {
        var request = new SharkWebRequest <DeviceChangeCodeResponseData>("user/takeOver");

        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "takeOverId", takeOverId },
            { "takeOverPassword", takeOverPass },
            { "authType", 3 },
            { "deviceType", SharkDefine.DEVICE_TYPE }
        });

        request.onSuccess = (response) =>
        {
            onCompleted?.Invoke(response);
        };

        request.onError = (errorCode) =>
        {
            onError?.Invoke(errorCode);
        };

        request.Send();
    }
コード例 #10
0
ファイル: MasterApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// マスターデータ取得通信
    /// </summary>
    public static void CallGetMasterApi(Action onCompleted, params Master.IDataBase[] dbs)
    {
#if SHARK_OFFLINE
        onCompleted?.Invoke();
        return;
#endif
        var request = new SharkWebRequest <Dictionary <string, object> >("master/getMaster");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "tableNameList", dbs.Select(x => x.tableName).ToArray() },
        });

        request.onSuccess = (response) =>
        {
            foreach (var db in dbs)
            {
                db.SetList(response[db.tableName].ToString());
            }

            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #11
0
    /// <summary>
    /// 受け取り通信
    /// </summary>
    public static void CallReceiveApi(TPresentBox[] dataList, Action <ReceiveListResponseData> onCompleted, Action <int> onError)
    {
        var presentBoxType   = (dataList[0] is TPresentBoxLimited) ? PresentBoxType.Limited : PresentBoxType.NonLimited;
        var presentBoxIdList = dataList.Select(x => x.id).ToArray();

        //リクエスト作成
        var request = new SharkWebRequest <ReceiveListResponseData>("present/receiveList");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        //リクエストパラメータセット
        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "presentBoxType", presentBoxType },
            { "presentBoxIdList", presentBoxIdList },
        });

        //通信完了時コールバック登録
        request.onSuccess = (response) =>
        {
            if (response.tPresentBoxReceived != null)
            {
                //アイテム付与
                foreach (var item in response.tPresentBoxReceived)
                {
                    UserData.Get().AddItem((ItemType)item.itemType, item.itemId, item.itemNum);
                }
            }

            //ユーザー情報同期
            if (response.tUsers != null)
            {
                UserData.Get().Set(response.tUsers);
            }

            //ジェム同期
            if (response.tGem != null)
            {
                UserData.Get().Set(response.tGem);
            }

            //ヘッダー更新
            SharedUI.Instance.header.SetInfo(UserData.Get());

            HomeScene.isMaxPossession = response.isMaxPossession;

            //通信完了
            onCompleted?.Invoke(response);
        };

        //エラー時の対応を追加
        request.onError = onError;

        //通信開始
        request.Send();
    }
コード例 #12
0
    /// <summary>
    /// まとめてギア分解情報の通信
    /// </summary>
    public static void CallSellGearList(List <uint> gearList, Action onCompleted)
    {
        var request = new SharkWebRequest <GearDecompositionListResponseData>("cannon/gearSellList");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);
        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "gearIdList", gearList }
        });

        /// 成功時
        request.onSuccess = (response) =>
        {
            //コイン消費の反映
            UserData.Get().Set(response.tUsers);
            SharedUI.Instance.header.SetInfo(UserData.Get());

            // addItem responseデータ、itemIdとstockCountの順にソート
            var addItemSort = response.mItemSell
                              .OrderBy(x => x.itemId)
                              .ThenBy(c => c.itemNum)
                              .ToArray();

            // アイテム追加
            foreach (var item in addItemSort)
            {
                // BattleItemの場合
                if ((ItemType)item.itemType == ItemType.BattleItem)
                {
                    // 現在所有するアイテム数
                    uint userStockCount = UserData.Get().itemData
                                          .Where(x => x.itemId == item.itemId)
                                          .Select(x => x.stockCount)
                                          .SingleOrDefault();

                    // 追加するアイテム数
                    uint addNum = item.itemNum - userStockCount;
                    // アイテム追加
                    UserData.Get().AddItem((ItemType)item.itemType, item.itemId, addNum);
                }
            }

            // 分解した、ギア削除
            foreach (var item in response.tGear)
            {
                var list  = UserData.Get().gearData.ToList();
                var index = list.FindIndex(x => x.serverId == item.serverId);
                list.RemoveAt(index);
                UserData.Get().gearData = list.ToArray();
            }
            onCompleted?.Invoke();
        };
        request.Send();
    }
コード例 #13
0
    /// <summary>
    /// VIPレベル、補償チェック取得通信
    /// </summary>
    public static void CallVipLevelApi(Action <VipLevelCheckResponseData> onCompleted)
    {
        var request = new SharkWebRequest <VipLevelCheckResponseData>("vip/vipLevel");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.onSuccess = (response) =>
        {
            onCompleted?.Invoke(response);
        };

        request.Send();
    }
コード例 #14
0
ファイル: MultiPlayApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// マルチプレイトップ画面情報取得通信
    /// </summary>
    public static void CallTopApi(Action <TopResponseData> onCompleted)
    {
        var request = new SharkWebRequest <TopResponseData>("multi/top");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.onSuccess = (response) =>
        {
            onCompleted?.Invoke(response);
        };

        request.Send();
    }
コード例 #15
0
    /// <summary>
    /// ユーザー機器移動情報取得通信
    /// </summary>
    public static void CallCreateDeviceChangeCode(Action <CreateDeviceChangeCodeResponseData> onCompleted)
    {
        var request = new SharkWebRequest <CreateDeviceChangeCodeResponseData>("user/createCode");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.onSuccess = (response) =>
        {
            onCompleted?.Invoke(response);
        };

        request.Send();
    }
コード例 #16
0
    /// <summary>
    /// ミッションリスト取得通信
    /// </summary>
    public static void CallMissionProgressApi(Action <MissionProgressResponseData> onCompleted)
    {
        var request = new SharkWebRequest <MissionProgressResponseData>("mission/missionProgress");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.onSuccess = (response) =>
        {
            response.Setup();
            onCompleted?.Invoke(response);
        };

        request.Send();
    }
コード例 #17
0
ファイル: MultiPlayApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// レベルアップ通信
    /// </summary>
    public static void CallLevelUpApi(LogData logData, Action <LevelUpResponseData> onCompleted)
    {
        var request = new SharkWebRequest <LevelUpResponseData>("multiPlaying/levelUp");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.SetRequestParameter(logData.ToRequestParameter());

        request.onSuccess = (response) =>
        {
            onCompleted?.Invoke(response);
        };

        request.Send();
    }
コード例 #18
0
ファイル: MultiPlayApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// マルチゲーム終了
    /// </summary>
    public static void CallClearApi(LogData logData, Action onCompleted)
    {
        var request = new SharkWebRequest <ClearResponseData>("multi/multiClear");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.SetRequestParameter(logData.ToRequestParameter());

        request.onSuccess = (response) =>
        {
            UserData.Get().Set(response.tUsers);
            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #19
0
ファイル: TopApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// リソースバージョン取得通信
    /// </summary>
    public static void CallTopApi(Action <string> onCompleted)
    {
        var request = new SharkWebRequest <object>("top");

        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "deviceType", SharkDefine.DEVICE_TYPE },
        });

        request.onSuccess = (response) =>
        {
            onCompleted?.Invoke(request.resourceVersion);
        };

        request.Send();
    }
コード例 #20
0
    /// <summary>
    /// 使用する砲台の変更通信
    /// </summary>
    public static void CallUseApi(uint settingNumber, Action onCompleted)
    {
#if SHARK_OFFLINE
        {
            var userData           = UserData.Get();
            var selectedTurretData = userData.GetSelectedTurretData();
            if (selectedTurretData != null)
            {
                selectedTurretData.useFlg = 0;
            }
            userData.turretData.First(x => x.settingNumber == settingNumber).useFlg = 1;
            onCompleted?.Invoke();
            return;
        }
#endif
        var request = new SharkWebRequest <CannonUseResponseData>("cannon/use");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "settingNumber", settingNumber }
        });

        request.onSuccess = (response) =>
        {
            var userData = UserData.Get();
            for (int i = 0; i < userData.turretData.Length; i++)
            {
                if (userData.turretData[i].settingNumber == settingNumber)
                {
                    //現在の選択状態を解除
                    var selectedTurretData = userData.GetSelectedTurretData();
                    if (selectedTurretData != null)
                    {
                        selectedTurretData.useFlg = 0;
                    }
                    //レスポンスで更新
                    userData.turretData[i] = response.tCannonSetting;
                    break;
                }
            }
            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #21
0
    /// <summary>
    /// ミッションの報酬受け取り通信
    /// </summary>
    public static void CallGetMissionRewardApi(MissionProgress progress, Action <MissionRewardResponseData> onCompleted)
    {
        //リクエスト作成
        var request = new SharkWebRequest <MissionRewardResponseData>("mission/getMissionReward");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        //リクエストパラメータセット
        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "tMissionId", progress.tMissionId },
            { "missionGroupId", (uint)progress.category }
        });

        //通信完了時コールバック登録
        request.onSuccess = (response) =>
        {
            response.Setup();

            //アイテムの付与
            UserData.Get().AddItem((ItemType)response.mMissionReward.itemType, response.mMissionReward.itemId, response.mMissionReward.itemNum);

            //ジェムの同期
            if (response.tGem != null)
            {
                UserData.Get().Set(response.tGem);
            }

            //ユーザー情報の同期
            if (response.tUsers != null)
            {
                UserData.Get().Set(response.tUsers);
            }

            //ヘッダ更新
            SharedUI.Instance.header.SetInfo(UserData.Get());

            //無期限のプレゼントBoxの上限を超えているかのフラグ
            HomeScene.isMaxPossession = response.isMaxPossession;

            //通信完了
            onCompleted?.Invoke(response);
        };

        //通信開始
        request.Send();
    }
コード例 #22
0
ファイル: BillingApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// 有償石の購入履歴の取得
    /// </summary>
    public static void CallHistoryApi(Action onCompleted)
    {
        //リクエスト作成
        var request = new SharkWebRequest <HistoryResponseData>("billing/history");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        //通信完了時コールバック登録
        request.onSuccess = (response) =>
        {
            //通信完了
            onCompleted?.Invoke();
        };

        //通信開始
        request.Send();
    }
コード例 #23
0
    /// <summary>
    /// ギアロック情報の通信
    /// </summary>
    public static void CallGearLock(UserGearData geardata, Action onCompleted)
    {
        var request = new SharkWebRequest <GearLockResponseData>("cannon/gearLock");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);
        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "gearId", geardata.serverId }
        });

        request.onSuccess = (response) =>
        {
            geardata.lockFlg = response.tGear.lockFlg;
            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #24
0
    /// <summary>
    /// ユーザー名変更通信
    /// </summary>
    public static void CallChangeUserNameApi(string changeuserName, Action onCompleted)
    {
        var request = new SharkWebRequest <ChangeUserNameResponseData>("user/edit");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);
        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "userName", changeuserName }
        });

        request.onSuccess = (response) =>
        {
            UserData.Get().Set(response.tUsers);
            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #25
0
    /// <summary>
    /// プレゼントBox内のアイテムと受け取り履歴を取得する通信
    /// </summary>
    public static void CallListApi(Action <ListResponseData> onCompleted)
    {
        //リクエスト作成
        var request = new SharkWebRequest <ListResponseData>("present/list");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        //通信完了時コールバック登録
        request.onSuccess = (response) =>
        {
            HomeScene.isMaxPossession |= response.tPresentBoxCount + response.tPresentBoxLimitedCount > Masters.ConfigDB.Get().maxPresentBox;

            onCompleted?.Invoke(response);
        };

        //通信開始
        request.Send();
    }
コード例 #26
0
ファイル: LoginApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// ログイン通信
    /// </summary>
    public static void CallLoginApi(UserData userData, Action onCompleted)
    {
        //リクエスト作成
        var request = new SharkWebRequest <LoginResponseData>("user/login");

        //リクエストパラメータセット
        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "userId", userData.userId },
            { "password", userData.password },
            { "authType", 3 },
            { "deviceType", SharkDefine.DEVICE_TYPE },
        });

        //通信完了時コールバック登録
        request.onSuccess = (response) =>
        {
            //ログインの合否を判定
            // ToDo 自身の端末内のパスワードが消失した場合にはアカウントの再発行となるので
            //      アカウント作り直しのフローを作る必要がある

            /*if (!response.loginSuccess)
             * {
             *  //リトライ用のダイアログを設定
             *  SimpleDialog dialog = SharedUI.Instance.ShowSimpleDialog();
             *  var content = dialog.SetAsMessageDialog("ログインに失敗しました" + "\n" + "login_success = " + response.loginSuccess);
             *  content.buttonGroup.buttons[0].onClick = dialog.Close;
             *  dialog.onClose = onRetry;
             *  return;
             * }*/

            //ログイン時に取得するuserIDとhashの設定
            userData.Set(response.userData);
            userData.Save();

            HomeScene.isMaxPossession = response.isMaxPossession;

            //通信完了
            onCompleted?.Invoke();
        };

        //通信開始
        request.Send();
    }
コード例 #27
0
    /// <summary>
    /// 砲台のセット通信
    /// </summary>
    public static void CallSetApi(
        uint settingNumber,
        uint batteryServerId,
        uint barrelServerId,
        uint bulletServerId,
        uint accessoryServerId,
        Action onCompleted)
    {
#if SHARK_OFFLINE
        {
            onCompleted?.Invoke();
            return;
        }
#endif
        var request = new SharkWebRequest <CannonSetResponseData>("cannon/set");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "settingNumber", settingNumber },
            { "batteryCannonId", batteryServerId },
            { "barrelCannonId", barrelServerId },
            { "bulletCannonId", bulletServerId },
            { "accessoriesCannonId", accessoryServerId },
        });

        request.onSuccess = (response) =>
        {
            var userData = UserData.Get();
            for (int i = 0; i < userData.turretData.Length; i++)
            {
                if (userData.turretData[i].settingNumber == settingNumber)
                {
                    userData.turretData[i] = response.tCannonSetting;
                    break;
                }
            }
            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #28
0
    /// <summary>
    /// パーツロック情報の通信
    /// </summary>
    public static void CallCannonLock(UserPartsData partsData, Action onCompleted)
    {
        var request = new SharkWebRequest <CannonLockResponseData>("cannon/cannonLock");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);
        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "cannonId", partsData.serverId },
            { "cannonType", partsData.itemType }
        });

        request.onSuccess = (response) =>
        {
            partsData.lockFlg = response.tCannon.lockFlg;
            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #29
0
ファイル: UtilityApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// ギアインベントリから、所持制限拡張通信
    /// </summary>
    public static void CallExpansionGearApi(Action onCompleted)
    {
        var request = new SharkWebRequest <ExpansionGearPossessionResponseData>("utility/maxGearPossession");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.onSuccess = (response) =>
        {
            UserData userData = UserData.Get();
            userData.Set(response.tUsers);
            userData.Set(response.tGem);
            userData.Set(response.tUtility);
            SharedUI.Instance.header.SetInfo(userData);

            onCompleted?.Invoke();
        };

        request.Send();
    }
コード例 #30
0
ファイル: MultiPlayApi.cs プロジェクト: musha-tetsuya/SHARK
    /// <summary>
    /// マルチゲーム開始
    /// </summary>
    public static void CallStartApi(uint worldId, string roomId, Action onCompleted)
    {
        var request = new SharkWebRequest <object>("multi/multiStart");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "multiWorldId", worldId },
            { "roomId", roomId },
        });

        request.onSuccess = (response) =>
        {
            onCompleted?.Invoke();
        };

        request.Send();
    }