using UnityEngine;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Linq;
|
|
using System;
|
using vnxbqy.UI;
|
|
|
public class StrengthenModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
{
|
PackModel _playerPack;
|
PackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); } }
|
public void OnBeforePlayerDataInitialize()
|
{
|
|
}
|
public override void Init()
|
{
|
|
|
}
|
|
public override void UnInit()
|
{
|
|
}
|
|
public void OnPlayerLoginOk()
|
{
|
|
}
|
//===========羽翼精炼
|
Dictionary<int, WingRefineAttrModel> _DicWingRe = new Dictionary<int, WingRefineAttrModel>();
|
class WingRefineAttrModel
|
{
|
public int Ability1;//属性值1
|
public int Ability1Value;//数值1
|
public int Ability2;//属性值2
|
public int Ability2Value;//数值2
|
|
}
|
private List<WingRefineAttrConfig> tegWing = new List<WingRefineAttrConfig>();
|
void WingRefine()//精炼属性
|
{
|
if (tegWing.Count <= 0)
|
{
|
tegWing = WingRefineAttrConfig.GetValues();
|
}
|
//var tegWing = WingRefineAttrConfig.GetValues();
|
foreach (var values in tegWing)
|
{
|
if (!_DicWingRe.ContainsKey(values.wingsPhase))
|
{
|
WingRefineAttrModel _wingRefineAttrModel = new WingRefineAttrModel();
|
int[] array = ConfigParse.GetKeyValueKeys<int>(values.attrupper);
|
int[] intarray = ConfigParse.GetKeyValueValues<int>(values.attrupper);
|
_wingRefineAttrModel.Ability1 = array[0];
|
_wingRefineAttrModel.Ability2 = array[1];
|
|
_wingRefineAttrModel.Ability1Value = intarray[0];
|
_wingRefineAttrModel.Ability2Value = intarray[1];
|
_DicWingRe.Add(values.wingsPhase, _wingRefineAttrModel);
|
|
}
|
}
|
}
|
|
public float[] BackpackWings(int ItemID, int _Refining)//用于背包 翅膀(1.翅膀ID,2.精炼值)
|
{
|
WingRefine();
|
int _currentRefiningAll = 0;//总精炼度
|
ItemConfig Item = ItemConfig.Get(ItemID);
|
if (tegWing.Count <= 0)
|
{
|
tegWing = WingRefineAttrConfig.GetValues();
|
}
|
// var configs = WingRefineAttrConfig.GetValues();
|
foreach (var values in tegWing)
|
{
|
if (Item.LV == values.wingsPhase)
|
{
|
_currentRefiningAll = values.EXPupper;//总精炼度
|
if (_Refining >= _currentRefiningAll)
|
{
|
_Refining = _currentRefiningAll;
|
}
|
}
|
}
|
|
float _RefiningRatio = (float)_Refining / _currentRefiningAll;//精炼比值
|
float _RefiningDegrees = _DicWingRe[Item.LV].Ability2Value * _RefiningRatio;
|
float _life = _DicWingRe[Item.LV].Ability1Value * _RefiningRatio;
|
float[] _floList = new float[2];
|
_floList[0] = _RefiningDegrees;
|
_floList[1] = _life;
|
return _floList;
|
}
|
|
public bool IsHint(int ID)
|
{
|
if (WingRefineAttrConfig.Get(ID) == null)
|
{
|
return false;
|
}
|
ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
|
if (itemModel.GetUseData((int)ItemUseDataKey.wingProgressValue) != null)
|
{
|
int currentRefining = 0;
|
int currentReAll = 0;
|
currentRefining = itemModel.GetUseData((int)ItemUseDataKey.wingProgressValue)[0];//当前精炼度
|
if (tegWing.Count <= 0)
|
{
|
tegWing = WingRefineAttrConfig.GetValues();
|
}
|
// var wingRefineAttrConfigs = WingRefineAttrConfig.GetValues();
|
foreach (var value in tegWing)
|
{
|
if (itemModel.config.LV == value.wingsPhase)
|
{
|
currentReAll = value.EXPupper;//总精炼度
|
}
|
}
|
if (currentReAll > currentRefining)
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
|
}
|