Beispiel #1
0
 public EditorStates(EditorCache cache)
 {
     EditorName = cache.CanvasName;
     Nodes      = cache.Nodes;
     Actors     = cache.Actors;
     Conditions = cache.Conditions;
     Init();
 }
Beispiel #2
0
        public static EditorCache NewCache()
        {
            EditorCache cache = CreateInstance <EditorCache> ();

            cache.CanvasName = "New Canvas";
            cache.Actors     = ActorDatabase.CreateNew <ActorDatabase> (cache.CanvasName);
            cache.Conditions = ConditionDatabase.CreateNew <ConditionDatabase> (cache.CanvasName);
            cache.Nodes      = NodeDatabase.CreateNew <NodeDatabase> (cache.CanvasName);
            cache.States     = new EditorStates(cache);

            cache.Init();
            SaveManager.SaveCanvas(ResourceManager.TEMPFILEPATH, false, cache);
            return(cache);
        }
            public override void OnGUI()
            {
                Event current   = Event.current;
                Rect  tolerance = new Rect(position);

                tolerance.xMin -= 20;
                tolerance.xMax += 20;
                tolerance.yMin -= 20;
                tolerance.yMax += 20;

                bool hasFocus = tolerance.Contains(current.mousePosition);

                CanvasGUI.BeginGroup(position, GUI.skin.box, hasFocus);

                ConditionDatabase conditions = DialogueEditorGUI.Cache.Conditions;

                obj.Condition = conditions.Get(CanvasGUI.DropDownMenu(new Rect(5, 5, position.width - 10, 20), position,
                                                                      conditions.GetIndex(obj.Condition), conditions.ItemNames.ToArray()));

                for (int i = 0; i < obj.ConditionValues.Count; i++)
                {
                    var val = obj.ConditionValues[i];

                    CanvasGUI.TextLabel(new Rect(30, 30 + 25 * 1, 20, 20), val.userParam.ToString());

                    string[] names = Enum.GetNames(typeof(EqualityState));
                    val.equality = (EqualityState)Enum.Parse(typeof(EqualityState),
                                                             names[CanvasGUI.DropDownMenu(new Rect(5, 30 + 25, 100, 20), (int)val.equality, names)]);
                }

                CanvasGUI.EndGroup();

                if (current.type == EventType.MouseUp && !hasFocus)
                {
                    close = true;
                }

                if (!obj || close)
                {
                    UpdateOverlays(obj);
                }
            }
Beispiel #4
0
 public void ReplaceAllReferences(Func <ScriptableObject, ScriptableObject> ReplacedSO)
 {
     nodes      = ReplacedSO(nodes) as NodeDatabase;
     actors     = ReplacedSO(actors) as ActorDatabase;
     conditions = ReplacedSO(conditions) as ConditionDatabase;
 }