private void InitAnimType() { TypeRect = new Rect(0, 0, WinW / 4, WinH); AnimTypeInfos = new BtnGuidInfo[] { new BtnGuidInfo("出生状态", Color.yellow), new BtnGuidInfo("待机状态", Color.red), new BtnGuidInfo("技能状态", Color.red), new BtnGuidInfo("死亡状态", Color.green), }; }
protected override void CustomInit() { base.CustomInit(); TypeInfos = new BtnGuidInfo[] { new BtnGuidInfo("组合节点", Color.red), new BtnGuidInfo("修饰节点", Color.cyan), new BtnGuidInfo("条件节点(子节点)", Color.green), new BtnGuidInfo("动作节点(子节点)", Color.blue) }; InitComplete(); }
public static T DrawSelectBtnGuid <T>(ref BtnGuidInfo[] infos, float w = 100f, float h = 20f) { if (infos != null) { Array list = Enum.GetValues(typeof(T)); for (int i = 0; i < list.Length; i++) { GUILayout.Space(2f); BtnGuidInfo info = infos[i]; if (!info.Value) { GUI.backgroundColor = info.UIColor; } else { GUI.backgroundColor = info.UIColor * Color.gray * Color.gray; } GUI.changed = false; bool state = GUILayout.Toggle(info.Value, info.Title, "button", GUILayout.Width(w), GUILayout.Height(h)); if (state != info.Value) { for (int j = 0; j < infos.Length; j++) { if (i != j) { infos[j].Value = false; } } infos[i].Value = state; return((T)list.GetValue(i)); } GUILayout.Space(2f); GUI.backgroundColor = Color.white; } for (int i = 0; i < list.Length; i++) { BtnGuidInfo info = infos[i]; if (info != null && info.Value == true) { return((T)list.GetValue(i)); } } } infos[0].Value = true; return(default(T)); }