暂时存档
Timeline WindowAnim不止window能用
This commit is contained in:
@@ -18,15 +18,14 @@ namespace Ichni.Editor
|
||||
|
||||
public void Initialize(IBaseElement baseElement, string title, string parameterName)
|
||||
{
|
||||
transform.localScale = Vector3.zero;
|
||||
this.connectedBaseElement = baseElement;
|
||||
this.parameterName = parameterName;
|
||||
this.title.text = title;
|
||||
unitList = new List<DynamicUICompositeUnit>();
|
||||
closeButton.onClick.AddListener(() =>
|
||||
{
|
||||
ApplyParameters();
|
||||
Destroy(gameObject);
|
||||
});
|
||||
closeButton.onClick.AddListener(Quit);
|
||||
|
||||
StartCoroutine(WindowAnim.ShowPanel(gameObject));
|
||||
}
|
||||
|
||||
public void RemoveUnit(DynamicUICompositeUnit unit)
|
||||
@@ -47,9 +46,9 @@ namespace Ichni.Editor
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.stringUnit;
|
||||
|
||||
|
||||
//初始化:获取当前的List<string>,并生成对应的Unit
|
||||
List<string> list = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as List<string>;
|
||||
foreach (string item in list)
|
||||
@@ -57,14 +56,14 @@ namespace Ichni.Editor
|
||||
GenerateUnit(item);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
|
||||
//为添加新的Unit的按钮设置点击事件
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit("");
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
|
||||
//将当前所有Unit的值应用到对应的变量中
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
@@ -86,22 +85,22 @@ namespace Ichni.Editor
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.animatedFloatUnit;
|
||||
|
||||
|
||||
FlexibleFloat flexibleFloat = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as FlexibleFloat;
|
||||
foreach (AnimatedFloat animatedFloat in flexibleFloat.animations)
|
||||
{
|
||||
GenerateUnit(animatedFloat);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit(new AnimatedFloat(0, 0, 0, 0, AnimationCurveType.Linear));
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
FlexibleFloat newFlexibleFloat = new FlexibleFloat();
|
||||
@@ -121,22 +120,22 @@ namespace Ichni.Editor
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.animatedIntUnit;
|
||||
|
||||
|
||||
FlexibleInt flexibleInt = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as FlexibleInt;
|
||||
foreach (AnimatedInt animatedInt in flexibleInt.animations)
|
||||
{
|
||||
GenerateUnit(animatedInt);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit(new AnimatedInt(0, 0));
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
FlexibleInt newFlexibleInt = new FlexibleInt();
|
||||
@@ -156,7 +155,7 @@ namespace Ichni.Editor
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.animatedBoolUnit;
|
||||
FlexibleBool flexibleBool = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as FlexibleBool;
|
||||
foreach (AnimatedBool animatedBool in flexibleBool.animations)
|
||||
@@ -164,13 +163,13 @@ namespace Ichni.Editor
|
||||
GenerateUnit(animatedBool);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit(new AnimatedBool(0, false));
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
FlexibleBool newFlexibleBool = new FlexibleBool();
|
||||
@@ -181,5 +180,12 @@ namespace Ichni.Editor
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, newFlexibleBool);
|
||||
};
|
||||
}
|
||||
public void Quit()
|
||||
{
|
||||
ApplyParameters();
|
||||
//StartCoroutine(WindowAnim.HidePanel(gameObject, true));
|
||||
Destroy(gameObject);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,20 +10,25 @@ namespace Ichni.Editor
|
||||
public GameElement connectedGameElement;
|
||||
public RectTransform WindowRect { get; set; }
|
||||
public List<DynamicUIContainer> Containers { get; set; }
|
||||
|
||||
|
||||
public void Initialize(GameElement gameElement, string title)
|
||||
{
|
||||
StartCoroutine(WindowAnim.ShowPanel(gameObject));
|
||||
WindowRect = windowRect;
|
||||
Containers = new List<DynamicUIContainer>();
|
||||
|
||||
|
||||
connectedGameElement = gameElement;
|
||||
this.title.text = title;
|
||||
closeButton.onClick.AddListener(() =>
|
||||
{
|
||||
Destroy(gameObject);
|
||||
});
|
||||
closeButton.onClick.AddListener(Quit);
|
||||
|
||||
}
|
||||
public void Quit()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
//StartCoroutine(WindowAnim.HidePanel(gameObject, true));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user