/// <summary> /// ギアスロットセット /// </summary> private void GearSlotReflesh(UserPartsData data) { this.isGearLockCount = 0; // パーツ別に、情報ロード PartsInfoBase partsInfo = null; // パーツが台座の場合 if (data.itemType == (uint)ItemType.Battery) { partsInfo = new BatteryPartsInfo(data); } // パーツが砲身の場合 else if (data.itemType == (uint)ItemType.Barrel) { partsInfo = new BarrelPartsInfo(data); } // パーツが台座の場合 else if (data.itemType == (uint)ItemType.Bullet) { partsInfo = new BulletPartsInfo(data); } //装着中ギアを時間順にソート var gears = UserData.Get().gearData .Where(x => x.partsServerId == data.serverId && x.gearType == (uint)partsInfo.gearType) .OrderBy(x => x.setDateTime) .ToArray(); // ギアID取得 for (int i = 0; i < SharkDefine.MAX_GEAR_SLOT_SIZE; i++) { uint gearId = 0; if (i < gears.Length) { gearId = gears[i].gearId; // 装着中ギアがロックされてたら、カウンター if (gears[i].lockFlg > 0) { this.isGearLockCount++; } } // ギア取付可能なスロット bool isExtended = i < partsInfo.defaultGearSlotSize + data.gearSlotExpandCount; // ギアスロットボタンセット this.gearSlotObject[i].SetUp(data, gearId, isExtended, this.OnClickGearSlotButton); } }
/// <summary> /// ギア Infoセット /// </summary> public void Reflesh(UserPartsData data) { PartsInfoBase partsInfo = null; if (data.itemType == (uint)ItemType.Battery) { partsInfo = new BatteryPartsInfo(data); } else if (data.itemType == (uint)ItemType.Barrel) { partsInfo = new BarrelPartsInfo(data); } else if (data.itemType == (uint)ItemType.Bullet) { partsInfo = new BulletPartsInfo(data); } // ゲージ最大値設定 var config = Masters.ConfigDB.FindById(1); var MAX_POWER = config.maxBulletPower; var MAX_BULLET_SPEED = config.maxBarrelSpeed; var MAX_FV_POINT_GET_VALUE = config.maxBatteryFvPoint; // パーツ別各能力 this.fvPointGetValue = partsInfo.fvPoint; this.bulletSpeed = partsInfo.speed; this.power = partsInfo.power; // ギア別各能力 this.gearFvPointGetValue = partsInfo.gearFvPointGetValue; this.gearBulletSpeed = partsInfo.gearBulletSpeed; this.gearPower = partsInfo.gearPower; // Sprite, CommonIcon セット var iconSprite = AssetManager.FindHandle <Sprite>(partsInfo.spritePath).asset as Sprite; this.partsIcon.SetIconSprite(iconSprite); this.partsIcon.SetRank((Rank)partsInfo.rarity); this.partsIcon.SetGearSlot(data); // 名前、説明 this.titleNameText.text = partsInfo.titleName; this.partsNameText.text = partsInfo.name; this.partsInfoText.text = partsInfo.description; // FvPゲージ設定 if (data.itemType == (uint)ItemType.Battery) { float f; if (this.fvPointGetValue + this.gearFvPointGetValue < MAX_FV_POINT_GET_VALUE / 5) { f = 0.2f; } else { f = (float)(this.fvPointGetValue + this.gearFvPointGetValue) / MAX_FV_POINT_GET_VALUE; } //float f = (float)((this.fvPointGetValue + this.gearFvPointGetValue) - CustomTurretScene.minBatteryFvPoint) / (MAX_FV_POINT_GET_VALUE - CustomTurretScene.minBatteryFvPoint) + 0.2f; this.fvPointGetValueGauge.SetGaugeValue(Mathf.Clamp01(f)); this.powerGauge.SetGaugeValue(Mathf.Clamp01((float)(this.power + this.gearPower) / MAX_POWER)); this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01((float)(this.bulletSpeed + this.gearBulletSpeed) / MAX_BULLET_SPEED)); } // 発射速度ゲージ設定 else if (data.itemType == (uint)ItemType.Barrel) { float s; if (this.bulletSpeed + this.gearBulletSpeed < MAX_BULLET_SPEED / 5) { s = 0.2f; } else { s = (float)(this.bulletSpeed + this.gearBulletSpeed) / MAX_BULLET_SPEED; } //float s = (float)((this.bulletSpeed + this.gearBulletSpeed) - CustomTurretScene.minBarrelSpeed) / (MAX_BULLET_SPEED - CustomTurretScene.minBarrelSpeed) + 0.2f; this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01(s)); this.powerGauge.SetGaugeValue(Mathf.Clamp01((float)(this.power + this.gearPower) / MAX_POWER)); this.fvPointGetValueGauge.SetGaugeValue(Mathf.Clamp01((float)(this.fvPointGetValue + this.gearFvPointGetValue) / MAX_FV_POINT_GET_VALUE)); } // 攻撃力ゲージ設定 else if (data.itemType == (uint)ItemType.Bullet) { float p; if (this.power + this.gearPower < MAX_POWER / 5) { p = 0.2f; } else { p = (float)(this.power + this.gearPower) / MAX_POWER; } //float p = (float)((this.power + this.gearPower) - CustomTurretScene.minBulletPower) / (MAX_POWER - CustomTurretScene.minBulletPower) + 0.2f; this.powerGauge.SetGaugeValue(Mathf.Clamp01(p)); this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01((float)(this.bulletSpeed + this.gearBulletSpeed) / MAX_BULLET_SPEED)); this.fvPointGetValueGauge.SetGaugeValue(Mathf.Clamp01((float)(this.fvPointGetValue + this.gearFvPointGetValue) / MAX_FV_POINT_GET_VALUE)); } }
/// <summary> /// ギア情報セット /// </summary> public void SetGearData(UserGearData data, Action onReflesh, Action onRefleshDecomposition) { this.gearData = data; this.onReflesh = onReflesh; this.onRefleshDecomposition = onRefleshDecomposition; // CommonIconをギアに変更 this.commonIcon.SetGearCommonIcon(true); // ギアアイコン情報セット this.gearCommonIcon.Set( data: data, isEquipped: data.partsServerId > 0, isLock: data.lockFlg, onClick: null ); // マスターデータ var gearMaster = Masters.GearDB.FindById(data.gearId); //現在ギアと所有するギアを比較の上、同数 uint[] gearIds = UserData.Get().gearData.Select(x => x.gearId).ToArray(); int count = 0; for (int i = 0; i < gearIds.Length; i++) { var userGearIds = gearIds[i].ToString(); var currentGearIds = data.gearId.ToString(); if (currentGearIds == userGearIds) { count++; } } // 同一のギア数テキスト this.overlapCountText.text = Masters.LocalizeTextDB.GetFormat("GearOverlapCount", count - 1); // 名前 this.gearNameText.text = gearMaster.name; // 説明 this.gearDescriptionText.text = gearMaster.description; // ゲージ、ギアを能力値 var config = Masters.ConfigDB.FindById(1); var power = gearMaster.power; var speed = gearMaster.speed; var fvPoint = gearMaster.fvPoint; // ゲージセット this.powerGauge.SetGaugeValue(Mathf.Clamp01((float)power / config.maxGearPower)); this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01((float)speed / config.maxGearSpeed)); this.fvPointGetCalueGauge.SetGaugeValue(Mathf.Clamp01((float)fvPoint / config.maxGearFvPoint)); // パーツ別に、情報ロード PartsInfoBase partsInfo = null; if (this.gearData.gearType == (uint)GearType.Battery) { partsInfo = new BatteryPartsInfo(data); } else if (this.gearData.gearType == (uint)GearType.Barrel) { partsInfo = new BarrelPartsInfo(data); } else if (this.gearData.gearType == (uint)GearType.Bullet) { partsInfo = new BulletPartsInfo(data); } if (data.partsServerId == null) { this.partsCommonIcon.gameObject.SetActive(false); this.needCoinArea.gameObject.SetActive(false); this.lockbutton.gameObject.SetActive(false); this.decompositionButton.gameObject.SetActive(true); this.lockbutton.gameObject.SetActive(false); } else { // パーツアイコン this.partsCommonIcon.countText.text = null; this.partsCommonIcon.gearArea.gameObject.SetActive(true); this.decompositionButton.gameObject.SetActive(false); this.lockbutton.gameObject.SetActive(true); // CommonIconパーツスプライトセット string Key = CommonIconUtility.GetSpriteKey((uint)partsInfo.itemType, partsInfo.partsMasterId); string Path = CommonIconUtility.GetSpritePath((uint)partsInfo.itemType, partsInfo.partsMasterId); var partsHandle = AssetManager.FindHandle <Sprite>(Path); this.partsCommonIcon.SetIconSprite(partsHandle.asset as Sprite); // CommonIconパーツランキングセット var partsRank = CommonIconUtility.GetRarity((uint)partsInfo.itemType, partsInfo.partsMasterId); this.partsCommonIcon.SetRank(partsRank); // CommonIconパーツ装着中ギアセット var partsGearSize = partsInfo.partsGearSize; for (int i = 0; i < this.partsCommonIcon.gearIcon.Length; i++) { this.partsCommonIcon.gearIcon[i].enabled = i < partsInfo.partsGearSlotCount; if (i < partsGearSize) { this.partsCommonIcon.gearOnIcon[i].gameObject.SetActive(true); } } // 装着中表示 this.partsEquippedMark.SetActive(partsInfo.partsIsEquiped); // 外すテキスト this.unEquipGearText.text = Masters.LocalizeTextDB.GetFormat("unitNeedCoin", Masters.GearDB.FindById(gearData.gearId).rejectCoin); } // ロックチェック if (data.lockFlg == 1) { this.lockOn.gameObject.SetActive(true); this.lockOff.gameObject.SetActive(false); } else { this.lockOn.gameObject.SetActive(false); this.lockOff.gameObject.SetActive(true); } // 分解詩修得アイテムマスターID取得 this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == Masters.GearDB.FindById(data.gearId).itemSellId).ToArray(); // 分解詩修得アイテムスクロールビュー this.decompositionScrollView.Initialize( this.decompositionItemPrefab.gameObject, this.getItem.Length, this.OnUpdateDecompositionScrollViewItem ); // ボタングレーアウトON/OFF if (this.gearData.lockFlg == 1) { this.SetGrayout(true); this.decompositionButton.interactable = false; } else { this.SetGrayout(false); } }
/// <summary> /// パーツ情報セット /// </summary> public void SetPartsData(UserPartsData data, bool isEquipped, Action onReflesh, Action onRefleshDecomposition) { this.partsData = data; this.onReflesh = onReflesh; this.onRefleshDecomposition = onRefleshDecomposition; this.isEquipped = isEquipped; // パーツアイコンセット partsCommonIcon.Set( data: data, isEquipped: isEquipped, isLock: data.lockFlg, onClick: null ); // パーツが台座の場合 if (this.partsData.itemType == (uint)ItemType.Battery) { partsInfo = new BatteryPartsInfo(data); // 台座FVアタックスプライトセット this.partsViewFvAttackIconImage.sprite = AssetManager.FindHandle <Sprite>(SharkDefine.GetFvAttackTypeIconSpritePath((FvAttackType)partsInfo.fvType)).asset as Sprite; // 台座FVアタック情報セット this.partsViewFvAttackNameText.text = partsInfo.fvName; this.partsViewFvAttackDescriptionText.text = partsInfo.fvDescription; } // パーツが砲身の場合 else if (this.partsData.itemType == (uint)ItemType.Barrel) { partsInfo = new BarrelPartsInfo(data); this.fvAttackArea.SetActive(false); } // パーツが砲弾の場合 else if (this.partsData.itemType == (uint)ItemType.Bullet) { partsInfo = new BulletPartsInfo(data); this.fvAttackArea.SetActive(false); } // パーツが装飾の場合 else if (this.partsData.itemType == (uint)ItemType.Accessory) { partsInfo = new DecorationPartsInfo(data); } // 同一のパーツ数テキスト this.overlapCountText.text = partsInfo.partsCount; // パーツ情報セット this.partsNameText.text = partsInfo.name; this.partsDescriptionText.text = partsInfo.description; // ゲージ var config = Masters.ConfigDB.FindById(1); var gearDatas = this.partsData.gearMasterIds.Select(gearId => Masters.GearDB.FindById(gearId)).ToArray(); // ギアスロットの全てのギアを能力値別に、合算 var gearPower = gearDatas.Select(x => (long)x.power).Sum(); var gearSpeed = gearDatas.Select(x => (long)x.speed).Sum(); var gearFvPoint = gearDatas.Select(x => (long)x.fvPoint).Sum(); // パーツはギア能力値を合算 uint power = partsInfo.power + (uint)gearPower; uint speed = partsInfo.speed + (uint)gearSpeed; uint fvPoint = partsInfo.fvPoint + (uint)gearFvPoint; Debug.LogFormat("power : {0}, bulletSpeed : {1}, fvPointGetValue{2} : {2}", power, speed, fvPoint); // ゲージ初期化 float gaugePower = 0f; float gaugeSpeed = 0f; float gaugeFvPoint = 0f; if (this.partsData.itemType == (uint)ItemType.Accessory) { this.fvAttackArea.SetActive(false); this.gaugeArea.SetActive(false); this.gearsArea.SetActive(false); } else { // パーツが砲弾の場合 if (this.partsData.itemType == (uint)ItemType.Bullet) { if (power < config.maxBulletPower / 5) { gaugePower = 0.2f; } else { gaugePower = (float)power / config.maxBulletPower; } gaugeSpeed = (float)speed / config.maxBarrelSpeed; gaugeFvPoint = (float)fvPoint / config.maxBatteryFvPoint; } // パーツが砲身の場合 else if (this.partsData.itemType == (uint)ItemType.Barrel) { if (speed < config.maxBarrelSpeed / 5) { gaugeSpeed = 0.2f; } else { gaugeSpeed = (float)speed / config.maxBarrelSpeed; } gaugePower = (float)power / config.maxBulletPower; gaugeFvPoint = (float)fvPoint / config.maxBatteryFvPoint; } // パーツが台座の場合 else if (this.partsData.itemType == (uint)ItemType.Battery) { if (speed < config.maxBatteryFvPoint / 5) { gaugeFvPoint = 0.2f; } else { gaugeFvPoint = (float)fvPoint / config.maxBatteryFvPoint; } gaugePower = (float)power / config.maxBulletPower; gaugeSpeed = (float)speed / config.maxBarrelSpeed; } // ゲージセット this.powerGauge.SetGaugeValue(Mathf.Clamp01(gaugePower)); this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01(gaugeSpeed)); this.fvPointGetCalueGauge.SetGaugeValue(Mathf.Clamp01(gaugeFvPoint)); // ギアスロットセット this.GearSlotReflesh(data); } // ロックチェック if (data.lockFlg == 1) { this.lockOn.gameObject.SetActive(true); this.lockOff.gameObject.SetActive(false); } else { this.lockOn.gameObject.SetActive(false); this.lockOff.gameObject.SetActive(true); } // 分解詩修得アイテムマスターID取得(ギアがない場合) if (gearDatas.Length == 0) { this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == partsInfo.itemSellId).ToArray(); // 分解詩修得アイテムスクロールビュー this.decompositionScrollView.Initialize( this.decompositionItemPrefab.gameObject, this.getItem.Length, this.OnUpdateDecompositionScrollViewItem ); } // 分解詩修得アイテムマスターID取得(ギアがある場合) else { // パーツの分解時アイテム取得 this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == partsInfo.itemSellId).ToArray(); // パーツの分解時取得アイテムをリストの変更 List <Master.ItemSellData> sellDatas = getItem.ToList(); for (int i = 0; i < gearDatas.Length; i++) { // ギアの分解時アイテム取得 Master.ItemSellData[] getGearItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == gearDatas[i].itemSellId).ToArray(); // getItemに追加 for (int y = 0; y < getGearItem.Length; y++) { sellDatas.Add(getGearItem[y]); } } // リスト配列に変更 this.getItem = sellDatas.ToArray(); // アイコンセット this.decompositionScrollView.Initialize( this.decompositionItemPrefab.gameObject, getItem.Length, this.OnUpdateDecompositionScrollViewItem ); } // ボタングレーアウトON/OFF if (this.partsData.lockFlg == 1 || this.partsData.useFlg || this.isGearLockCount > 0 || partsInfo.itemSellId == 0) { this.SetGrayout(true); this.decompositionButton.interactable = false; } else { this.SetGrayout(false); this.decompositionButton.interactable = true; } // 初期砲台の場合、分解不可能の案内メッセージ、テキストセット if (partsInfo.itemSellId == 0) { this.defaultCanonText.text = Masters.LocalizeTextDB.Get("CannotDisassembledDefaultCanon"); } else { this.defaultCanonText.text = null; } }