예제 #1
0
        /// <summary>
        /// 弾丸リスト更新時
        /// </summary>
        public void OnUpdateBulletDataList(object value)
        {
            //弾丸リスト
            var list = BinaryUtility.CreateArray <BulletDto>((byte[])value);

            //発射
            for (int i = 0; i < list.Length; i++)
            {
                var data = list[i];
                if (!this.bulletList.Exists(x => x.id == data.id))
                {
                    this.CreateBullet(data);
                    this.PlayBulletFiringAnimation();
                    this.StartBarrelRotation(data.barrelLocalEulerAngles);
                }
            }

            //破棄
            for (int i = 0; i < this.bulletList.Count; i++)
            {
                var data = this.bulletList[i];
                if (!list.Any(x => x.id == data.id))
                {
                    Destroy(data.bulletBase.gameObject);
                    this.bulletList.RemoveAt(i);
                    i--;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// セットアップ
        /// </summary>
        public override void Setup()
        {
            if (this.actorNo < 0)
            {
                return;
            }

            if (this.loader.GetStatus() != AssetListLoader.Status.Loaded)
            {
                return;
            }

            this.isSetuped = true;
            this.coinInfoPanel.gameObject.SetActive(true);
            this.uiBetButton.gameObject.SetActive(true);

            var    properties = this.GetCustomProperties();
            object value;

            if (properties.TryGetValue(PlayerPropertyKey.Coin, out value))
            {
                //コイン数表示
                this.coinInfoPanel.SetCoinNum((long)value);
            }

            if (properties.TryGetValue(PlayerPropertyKey.Bet, out value))
            {
                //BET数表示
                this.uiBetButton.SetBetNum((int)value);
            }

            if (this.isLocalPlayer)
            {
                var userData = BattleGlobal.instance.userData as MultiBattleUserData;

                base.Setup();

                //コインフレーム形状変更
                this.coinInfoPanel.SetForm(true);

                //BET操作ボタンの表示ON
                this.uiBetButton.SetButtonVisible(true);

                //FVAアイコン差し替え
                this.uiFvAttackGauge.Setup();

                //龍玉魂セット
                this.uiWhalePanel.SetBallNum(userData.ballNum);
                this.uiWhalePanel.SetSoulNum(userData.soulNum);
            }
            else
            {
                //ロード済みのはずのデータで見た目を更新
                this.turretBase.Reflesh();

                //BET操作ボタンの表示はOFF
                this.uiBetButton.SetButtonVisible(false);

                //弾丸リスト取得
                if (properties.TryGetValue(PlayerPropertyKey.BulletList, out value))
                {
                    var list = BinaryUtility.CreateArray <BulletDto>((byte[])value);

                    for (int i = 0; i < list.Length; i++)
                    {
                        //弾丸生成
                        var data = list[i];
                        this.CreateBullet(data);
                        this.turretBase.rotationParts.localEulerAngles = data.barrelLocalEulerAngles;
                    }
                }
            }
        }
예제 #3
0
    /// <summary>
    /// リソースリストチェック
    /// </summary>
    private void CheckResourceList()
    {
#if !USE_ASSETBUNDLE
        this.Login();
        return;
#endif
        //リソースバージョン取得通信
        TopApi.CallTopApi((resourceVersion) =>
        {
            var handle        = new FileDownloadHandle(resourceVersion, "infoList.dat");
            handle.isAutoSave = false;

            //リソースリストダウンロード開始
            var downloader = new FileDownloadManager();
            downloader.Add(handle);
            downloader.DownloadStart();

            //タッチブロック
            SharedUI.Instance.DisableTouch();

            //ダウンロード完了時
            downloader.onCompleted = () =>
            {
                //タッチブロック解除
                SharedUI.Instance.EnableTouch();

                var directory = AssetManager.GetAssetBundleDirectoryPath();

                //旧リソースリスト
                var oldInfoList = new List <AssetBundleInfo>();
                {
                    var path = Path.Combine(directory, handle.hash);
                    if (File.Exists(path))
                    {
                        var bytes = File.ReadAllBytes(path).Cryption();
                        oldInfoList.AddRange(BinaryUtility.CreateArray <AssetBundleInfo>(bytes));
                    }
                }

                //新リソースリスト
                var newInfoList = new List <AssetBundleInfo>();
                {
                    var bytes = handle.bytes.Cryption();
                    newInfoList.AddRange(BinaryUtility.CreateArray <AssetBundleInfo>(bytes));
                }

                //ダウンロード対象
                var targetInfoList = new List <AssetBundleInfo>();

                for (int i = 0; i < newInfoList.Count; i++)
                {
                    var targetInfo = newInfoList[i];
                    var filePath   = Path.Combine(directory, targetInfo.assetBundleName.GetHashString());

                    //既存ファイルの場合
                    if (File.Exists(filePath))
                    {
                        //CRC値が同じならダウンロードの必要無し
                        var oldInfo = oldInfoList.Find(x => x.assetBundleName == targetInfo.assetBundleName);
                        if (oldInfo != null && oldInfo.crc == targetInfo.crc)
                        {
                            continue;
                        }
                    }

                    //ダウンロード対象として追加
                    targetInfoList.Add(targetInfo);
                }

                //ダウンロードする必要があるなら
                if (targetInfoList.Count > 0)
                {
                    //確認ダイアログ表示
                    this.OpenDownlodConfirmDialog(targetInfoList, () =>
                    {
                        //ダウンロード開始
                        var dialog  = SharedUI.Instance.ShowSimpleDialog();
                        var content = dialog.AddContent(this.downloadDialogContentPrefab);
                        content.Setup(dialog, resourceVersion, oldInfoList, handle, targetInfoList);

                        //ダウンロード終わったら
                        dialog.onClose = () =>
                        {
                            //アセットバンドル情報のセット
                            AssetManager.SetAssetBundleInfoList(newInfoList);
                            //ログイン
                            this.Login();
                        };
                    });
                }
                else
                {
                    //アセットバンドル情報のセット
                    AssetManager.SetAssetBundleInfoList(newInfoList);
                    //ログイン
                    this.Login();
                }
            };
        });
    }