public override void OnInspectorGUI() { BCEditorTools.SetLabelWidth(130f); BCSetActiveTool bt = target as BCSetActiveTool; bt.Reverse = EditorGUILayout.Toggle("Set Active Reverse", bt.Reverse); for (int i = 0; i < bt.list.Count; i++) { BCEditorTools.BeginContents(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("-", GUILayout.Width(30))) { bt.list.RemoveAt(i); BCEditorTools.EndContents(); EditorGUILayout.EndHorizontal(); return; } GameObject go = EditorGUILayout.ObjectField(bt.list[i].go, typeof(GameObject)) as GameObject; EditorGUILayout.EndHorizontal(); bool setActive = EditorGUILayout.Toggle("Set Active", bt.list[i].setActive); BCEditorTools.EndContents(); if (GUI.changed) { BCEditorTools.RegisterUndo("Tween Change", bt); bt.list[i].go = go; bt.list[i].setActive = setActive; BCEditorTools.SetDirty(bt); } } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(" ", GUILayout.ExpandWidth(true)); if (GUILayout.Button("+", GUILayout.Width(50))) { BCSetActiveTool.SetActiveData addMe = new BCSetActiveTool.SetActiveData(); if (bt.list.Count > 0) { addMe.setActive = bt.list[bt.list.Count - 1].setActive; } bt.list.Add(addMe); } EditorGUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { if (!string.IsNullOrEmpty(bo.tip)) { EditorGUILayout.LabelField(bo.tip); } GUILayout.Space(3f); EditorGUILayout.BeginHorizontal(); searchstr = EditorGUILayout.TextField(searchstr); if (GUILayout.Button("按名搜")) { searchList.Clear(); searchList = bo.FindObjsByName(searchstr); } if (GUILayout.Button("按描述搜")) { searchList.Clear(); searchList = bo.FindObjsByTag(searchstr); } EditorGUILayout.EndHorizontal(); BCEditorTools.SetLabelWidth(130f); for (int i = 0; i < searchList.Count; i++) { GUI.color = Color.cyan; BCEditorTools.BeginContents(); GUI.color = Color.white; EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("-", GUILayout.Width(30))) { bo.objList.Remove(searchList[i]); searchList.RemoveAt(i); BCEditorTools.EndContents(); EditorGUILayout.EndHorizontal(); return; } Object obj = EditorGUILayout.ObjectField(searchList[i].obj, typeof(Object)); EditorGUILayout.EndHorizontal(); GUILayout.Space(2f); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("描述:", GUILayout.Width(40f)); string str = EditorGUILayout.TextField(searchList[i].Desc); EditorGUILayout.EndHorizontal(); GUILayout.Space(1f); BCEditorTools.EndContents(); if (GUI.changed) { BCEditorTools.RegisterUndo("Tween Change", bo); searchList[i].obj = obj; searchList[i].Desc = str; BCEditorTools.SetDirty(bo); } } for (int i = 0; i < bo.objList.Count; i++) { BCEditorTools.BeginContents(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("-", GUILayout.Width(30))) { bo.objList.RemoveAt(i); BCEditorTools.EndContents(); EditorGUILayout.EndHorizontal(); return; } Object obj = EditorGUILayout.ObjectField(bo.objList[i].obj, typeof(Object)); EditorGUILayout.EndHorizontal(); GUILayout.Space(2f); Rect titleRect = EditorGUILayout.BeginHorizontal(); titleRect.xMax = titleRect.xMin + 40f; if (Event.current.isMouse && Event.current.button == 1 && titleRect.Contains(Event.current.mousePosition)) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Duplicate one"), false, _duplicate, bo.objList[i]); if (bo.objList[i].obj != null && bo.objList[i].obj is AudioClip) { menu.AddItem(new GUIContent("Play Audio"), false, _PlayAudioClip, bo.objList[i]); } menu.ShowAsContext(); Event.current.Use(); } EditorGUILayout.LabelField("描述:", GUILayout.Width(40f)); string str = EditorGUILayout.TextField(bo.objList[i].Desc); EditorGUILayout.EndHorizontal(); GUILayout.Space(1f); BCEditorTools.EndContents(); if (GUI.changed) { BCEditorTools.RegisterUndo("Tween Change", bo); bo.objList[i].obj = obj; bo.objList[i].Desc = str; BCEditorTools.SetDirty(bo); } } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(" ", GUILayout.ExpandWidth(true)); if (GUILayout.Button("+", GUILayout.Width(50))) { BCDicOfObj.ObjData addMe = new BCDicOfObj.ObjData(); bo.objList.Add(addMe); } EditorGUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { BCEditorTools.SetLabelWidth(95f); _target.randMaker = (BCRandomMaker)EditorGUILayout.ObjectField("Random Maker", _target.randMaker, typeof(BCRandomMaker)); GUILayout.Space(5f); _target.durationRule = (BCTweenRandTrigger.TweenTimeRule)EditorGUILayout.EnumPopup("Duration", _target.durationRule); if (_target.durationRule == BCTweenRandTrigger.TweenTimeRule.ConstValue) { _target.duration = EditorGUILayout.FloatField("-> value", _target.duration); } else { _target.ruleTagDuration = EditorGUILayout.TextField("-> Tag", _target.ruleTagDuration); } _target.delayRule = (BCTweenRandTrigger.TweenTimeRule)EditorGUILayout.EnumPopup("Start Delay", _target.delayRule); if (_target.delayRule == BCTweenRandTrigger.TweenTimeRule.ConstValue) { _target.delay = EditorGUILayout.FloatField("-> value", _target.delay); } else { _target.ruleTagDelay = EditorGUILayout.TextField("-> Tag", _target.ruleTagDelay); } GUILayout.Space(5f); if (BCEditorTools.DrawHeader("Tween Transfrom")) { BCEditorTools.BeginContents(); BCEditorTools.SetLabelWidth(110f); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("From", GUILayout.Width(40)); BCEditorTools.BeginContents(); EditorGUILayout.BeginVertical(); _target.from_rule[0] = (BCTweenRandTrigger.TweenFromRule)EditorGUILayout.EnumPopup(_target.from_rule[0]); if (_target.from_rule[0] == BCTweenRandTrigger.TweenFromRule.ConstValue) { _target.from.x = EditorGUILayout.FloatField(_target.from.x); } else if (_target.from_rule[0] == BCTweenRandTrigger.TweenFromRule.RandValue) { BCEditorTools.SetLabelWidth(30f); _target.ruleTagFrom[0] = EditorGUILayout.TextField("Tag", _target.ruleTagFrom[0]); BCEditorTools.SetLabelWidth(110f); } EditorGUILayout.EndVertical(); BCEditorTools.EndContents(); BCEditorTools.BeginContents(); EditorGUILayout.BeginVertical(); _target.from_rule[1] = (BCTweenRandTrigger.TweenFromRule)EditorGUILayout.EnumPopup(_target.from_rule[1]); if (_target.from_rule[1] == BCTweenRandTrigger.TweenFromRule.ConstValue) { _target.from.y = EditorGUILayout.FloatField(_target.from.y); } else if (_target.from_rule[1] == BCTweenRandTrigger.TweenFromRule.RandValue) { BCEditorTools.SetLabelWidth(30f); _target.ruleTagFrom[1] = EditorGUILayout.TextField("Tag", _target.ruleTagFrom[1]); BCEditorTools.SetLabelWidth(110f); } EditorGUILayout.EndVertical(); BCEditorTools.EndContents(); BCEditorTools.BeginContents(); EditorGUILayout.BeginVertical(); _target.from_rule[2] = (BCTweenRandTrigger.TweenFromRule)EditorGUILayout.EnumPopup(_target.from_rule[2]); if (_target.from_rule[2] == BCTweenRandTrigger.TweenFromRule.ConstValue) { _target.from.z = EditorGUILayout.FloatField(_target.from.z); } else if (_target.from_rule[2] == BCTweenRandTrigger.TweenFromRule.RandValue) { BCEditorTools.SetLabelWidth(30f); _target.ruleTagFrom[2] = EditorGUILayout.TextField("Tag", _target.ruleTagFrom[2]); BCEditorTools.SetLabelWidth(110f); } EditorGUILayout.EndVertical(); BCEditorTools.EndContents(); EditorGUILayout.EndHorizontal(); GUILayout.Space(10); //---------------------------------------------------------- EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("To", GUILayout.Width(40)); BCEditorTools.BeginContents(); EditorGUILayout.BeginVertical(); _target.to_rule[0] = (BCTweenRandTrigger.TweenToRule)EditorGUILayout.EnumPopup(_target.to_rule[0]); if (_target.to_rule[0] == BCTweenRandTrigger.TweenToRule.ConstValue) { _target.to.x = EditorGUILayout.FloatField(_target.to.x); } else { BCEditorTools.SetLabelWidth(30f); _target.ruleTagTo[0] = EditorGUILayout.TextField("Tag", _target.ruleTagTo[0]); BCEditorTools.SetLabelWidth(110f); } EditorGUILayout.EndVertical(); BCEditorTools.EndContents(); BCEditorTools.BeginContents(); EditorGUILayout.BeginVertical(); _target.to_rule[1] = (BCTweenRandTrigger.TweenToRule)EditorGUILayout.EnumPopup(_target.to_rule[1]); if (_target.to_rule[1] == BCTweenRandTrigger.TweenToRule.ConstValue) { _target.to.y = EditorGUILayout.FloatField(_target.to.y); } else { BCEditorTools.SetLabelWidth(30f); _target.ruleTagTo[1] = EditorGUILayout.TextField("Tag", _target.ruleTagTo[1]); BCEditorTools.SetLabelWidth(110f); } EditorGUILayout.EndVertical(); BCEditorTools.EndContents(); BCEditorTools.BeginContents(); EditorGUILayout.BeginVertical(); _target.to_rule[2] = (BCTweenRandTrigger.TweenToRule)EditorGUILayout.EnumPopup(_target.to_rule[2]); if (_target.to_rule[2] == BCTweenRandTrigger.TweenToRule.ConstValue) { _target.to.z = EditorGUILayout.FloatField(_target.to.z); } else { BCEditorTools.SetLabelWidth(30f); _target.ruleTagTo[2] = EditorGUILayout.TextField("Tag", _target.ruleTagTo[2]); BCEditorTools.SetLabelWidth(110f); } EditorGUILayout.EndVertical(); BCEditorTools.EndContents(); EditorGUILayout.EndHorizontal(); BCEditorTools.EndContents(); } }
protected void DrawCommonProperties() { if (null == tw || null == onFinished || null == onWePointed1) { init(); } if (Application.isPlaying) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("PlayForward")) { tw.PlayForward(); } if (GUILayout.Button("PlayReverse")) { tw.PlayReverse(); } if (GUILayout.Button("PlayForwardForce")) { tw.PlayForwardForce(); } if (GUILayout.Button("PlayReverseForce")) { tw.PlayReverseForce(); } if (GUILayout.Button("Stop")) { tw.Stop(); } EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.HelpBox("Some buttons will appear when running.", MessageType.Info); } if (BCEditorTools.DrawHeader("Tweener")) { BCEditorTools.BeginContents(); BCEditorTools.SetLabelWidth(110f); GUI.changed = false; BCUITweener.Style style = (BCUITweener.Style)EditorGUILayout.EnumPopup("Play Style", tw.style); if (style == BCUITweener.Style.Once) { GUILayout.BeginHorizontal(); GUI.color = Color.white; GUILayout.EndHorizontal(); } AnimationCurve curve = EditorGUILayout.CurveField("Animation Curve", tw.animationCurve, GUILayout.Width(170f), GUILayout.Height(62f)); //UITweener.Method method = (UITweener.Method)EditorGUILayout.EnumPopup("Play Method", tw.method); GUILayout.BeginHorizontal(); float dur = EditorGUILayout.FloatField("Duration", tw.duration, GUILayout.Width(170f)); GUILayout.Label("seconds"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); float del = EditorGUILayout.FloatField("Start Delay", tw.delay, GUILayout.Width(170f)); GUILayout.Label("seconds"); GUILayout.EndHorizontal(); //int tg = EditorGUILayout.IntField("Tween Group", tw.tweenGroup, GUILayout.Width(170f)); bool ts = EditorGUILayout.Toggle("Ignore TimeScale", tw.ignoreTimeScale); if (GUI.changed) { BCEditorTools.RegisterUndo("Tween Change", tw); tw.animationCurve = curve; //tw.method = method; tw.style = style; tw.ignoreTimeScale = ts; //tw.tweenGroup = tg; tw.duration = dur; tw.delay = del; BCEditorTools.SetDirty(tw); GUI.changed = false; } BCEditorTools.EndContents(); } BCEditorTools.SetLabelWidth(80f); serializedObject.Update(); EditorGUILayout.PropertyField(onFinished); BCEditorTools.SetLabelWidth(120f); tw.EventPointsCount = EditorGUILayout.IntPopup("Events We Point", tw.EventPointsCount, chooseNumStr, chooseNum); if (tw.EventPointsCount > 0) { tw.tWePoint[0] = EditorGUILayout.Slider("Time We Point 1", tw.tWePoint[0], 0f, 1f); BCEditorTools.SetLabelWidth(80f); EditorGUILayout.PropertyField(onWePointed1); } BCEditorTools.SetLabelWidth(120f); if (tw.EventPointsCount > 1) { tw.tWePoint[1] = EditorGUILayout.Slider("Time We Point 2", tw.tWePoint[1], 0f, 1f); BCEditorTools.SetLabelWidth(80f); EditorGUILayout.PropertyField(onWePointed2); } BCEditorTools.SetLabelWidth(120f); if (tw.EventPointsCount > 2) { tw.tWePoint[2] = EditorGUILayout.Slider("Time We Point 3", tw.tWePoint[2], 0f, 1f); BCEditorTools.SetLabelWidth(80f); EditorGUILayout.PropertyField(onWePointed3); } serializedObject.ApplyModifiedProperties(); }