//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Friday, March 08, 2019
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
|
public class EquipTrainSet
|
{
|
public readonly int level = 1;
|
public Redpoint redpoint;
|
Dictionary<int, EquipTrain> equipTrains = new Dictionary<int, EquipTrain>();
|
|
public EquipTrainSet(int level)
|
{
|
this.level = level;
|
this.redpoint = new Redpoint(910000, 910000 + level * 100);
|
|
for (int i = 1; i <= 12; i++)
|
{
|
equipTrains[i] = new EquipTrain(this.level, i, EquipTrainModel.GetTrainType(i));
|
}
|
}
|
|
public void Reset()
|
{
|
foreach (var equipTrain in equipTrains.Values)
|
{
|
equipTrain.Reset();
|
}
|
}
|
|
public void UpdateEquipTrainLevel(int place, int trainLevel)
|
{
|
if (equipTrains.ContainsKey(place))
|
{
|
equipTrains[place].trainLevel = trainLevel;
|
}
|
}
|
|
public int GetTrainLevel(int place)
|
{
|
return equipTrains.ContainsKey(place) ? equipTrains[place].trainLevel : 0;
|
}
|
|
public void UpdateUnSavedProperties(int place, Int3 unSavedProperties)
|
{
|
if (equipTrains.ContainsKey(place))
|
{
|
equipTrains[place].unSavedProperties = unSavedProperties;
|
}
|
}
|
|
public void UpdateTrainedProperties(int place, Int3 trainedProperties)
|
{
|
if (equipTrains.ContainsKey(place))
|
{
|
equipTrains[place].trainedProperties = trainedProperties;
|
}
|
}
|
|
public Int3 GetUnSavedProperties(int place)
|
{
|
return equipTrains.ContainsKey(place) ? equipTrains[place].unSavedProperties : Int3.zero;
|
}
|
|
public Int3 GetTrainedProperties(int place)
|
{
|
return equipTrains.ContainsKey(place) ? equipTrains[place].trainedProperties : Int3.zero;
|
}
|
|
public void UpdateRedpoint(int place, RedPointState state)
|
{
|
if (equipTrains.ContainsKey(place))
|
{
|
equipTrains[place].redpoint.state = state;
|
}
|
}
|
|
public RedPointState GetRedpointState(int place)
|
{
|
if (equipTrains.ContainsKey(place))
|
{
|
return equipTrains[place].redpoint.state;
|
}
|
else
|
{
|
return RedPointState.None;
|
}
|
}
|
|
}
|
|
public class EquipTrain
|
{
|
public readonly int level;
|
public readonly int place;
|
public readonly int trainType;
|
public int trainLevel { get; set; }
|
public Int3 unSavedProperties { get; set; }
|
public Int3 trainedProperties { get; set; }
|
|
public Redpoint redpoint;
|
|
public EquipTrain(int level, int place, int trainType)
|
{
|
this.level = level;
|
this.place = place;
|
this.trainType = trainType;
|
this.trainLevel = 0;
|
|
redpoint = new Redpoint(910000 + level * 100, 910000 + level * 100 + place);
|
}
|
|
public void Reset()
|
{
|
this.trainLevel = 0;
|
this.unSavedProperties = Int3.zero;
|
this.trainedProperties = Int3.zero;
|
}
|
|
}
|
|
|
}
|