/// <summary> /// ギアスロットセット /// </summary> public void GearSlotReflesh(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 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; } // ギア取付可能なスロット 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); } }