예제 #1
0
 public void Remove(CChecker c)
 {
     if (checkers.Contains(c))
     {
         checkers.Remove(c);
     }
 }
예제 #2
0
 public void Add(CChecker c)
 {
     checkers.Add(c);
 }
예제 #3
0
 public override void AddCheck(CChecker c)
 {
     base.checkers.Add(c);
 }
예제 #4
0
 public override void RemoveCheck(CChecker c)
 {
     base.checkers.Remove(c);
 }
예제 #5
0
    private void DrawInspector()
    {
        inspector = o(main, main.size.x, 0, w.size.x - main.size.x, w.size.y);
        GUI.Box(inspector, "");

        if (selectedNode != null)
        {
            Rect nameBox = o(inspector, 20, 30, 80, 20);
            Rect nText   = duplicate(nameBox, 0, -20);
            selectedNode.name = GUI.TextField(nameBox, selectedNode.name);
            GUI.Label(nText, "Node Name :");
            Rect cText = duplicate(nameBox, 0, 30);
            GUI.Label(cText, "Tag Color :");
            Rect cPicker = duplicate(cText, 0, 20);
            selectedNode.tag = EditorGUI.ColorField(cPicker, selectedNode.tag);
            Rect cBut = duplicate(cPicker, 0, 20);
            if (GUI.Button(cBut, "Change"))
            {
                selectedNode.ChangeColor();
            }

            if (selectedNode.type != "B")
            {
                Rect effectT  = duplicate(cBut, 0, 30);
                Rect response = o(nameBox, 90, 0, 100, 140);
                selectedNode.response = GUI.TextArea(response, selectedNode.response);
                GUI.Label(effectT, "Effectors");
                Rect effectAdd = duplicate(effectT, 0, 20);
                if (GUI.Button(effectAdd, "+"))
                {
                    CEffector ef = new CEffector();
//					ef.dict = c.dict;
                    ef.type = CEffector.operationType.Add;
                    selectedNode.effectors.Add(ef);
                    Debug.Log("0:" + selectedNode.effectors[0].s);
                }
                if (selectedNode.effectors != null)
                {
                    List <CEffector> e        = selectedNode.effectors;
                    Rect             currentE = o(effectAdd, 0, 20, 80, 20);
                    GUI.Label(currentE, "Effectors :");
                    for (int i = 0; i < e.Count; i++)
                    {
                        //e [i].chat = c;
                        Rect pT = o(effectAdd, 0, 34 * (i + 1) + 30, 70, 20);
                        Rect bT = o(pT, -10, -5, 250, 30);
                        GUI.Box(bT, "");
                        e [i].s = GUI.TextField(pT, e [i].s);
                        Rect pF = o(pT, 75, 0, 30, 20);
                        e [i].f = EditorGUI.FloatField(pF, e [i].f);
                        Rect pE = o(pF, 35, 0, 60, 40);
                        e [i].type = (CEffector.operationType)EditorGUI.EnumPopup(pE, e [i].type);
                        Rect pM = o(pE, 65, 0, 20, 20);
                        if (GUI.Button(pM, "-"))
                        {
                            selectedNode.effectors.Remove(selectedNode.effectors [i]);
                        }
                    }
                }
            }
            else
            {
                Rect checkT = duplicate(cBut, 0, 30);
                GUI.Label(checkT, "Conditions");
                Rect effectR = duplicate(checkT, 0, 20);
                if (GUI.Button(effectR, "+"))
                {
                    CChecker cr = new CChecker();
//					cr.dict = c.dict;
                    selectedNode.checkers.Add(cr);
                }
                Rect effectAdd = duplicate(effectR, 0, 20);
                if (GUI.Button(effectAdd, "Start"))
                {
                    selectedNode.startNode = !selectedNode.startNode;
                    if (selectedNode.startNode)
                    {
                        selectedNode.tag = Color.green;
                        selectedNode.ChangeColor();
                        selectedNode.name = "START";
                    }
                }
                if (selectedNode.checkers != null)
                {
                    List <CChecker> cc       = selectedNode.checkers;
                    Rect            currentC = o(effectAdd, 0, 20, 80, 20);
                    GUI.Label(currentC, "Checkers : ");
                    for (int i = 0; i < cc.Count; i++)
                    {
                        Rect pT = o(effectAdd, 0, 34 * (i + 1) + 30, 70, 20);
                        Rect bT = o(pT, -10, -5, 270, 30);
                        GUI.Box(bT, "");
                        cc [i].propertyName = GUI.TextField(pT, cc [i].propertyName);
                        Rect pF = o(pT, 75, 0, 70, 40);
                        cc [i].checkType = (CChecker.propertyCheck)EditorGUI.EnumPopup(pF, cc [i].checkType);
                        Rect pV = o(pF, 75, 0, 70, 20);
                        cc [i].value = EditorGUI.FloatField(pV, cc [i].value);
                        Rect pM = o(pV, 75, 0, 20, 20);
                        if (GUI.Button(pM, "-"))
                        {
                            selectedNode.checkers.Remove(selectedNode.checkers [i]);
                        }
                    }
                }
            }
        }
        else
        {
            Rect AddBox = o(inspector, 20, 30, 130, 20);
            Rect nText  = duplicate(AddBox, 0, -20);
            if (GUI.Button(AddBox, "Add Property"))
            {
                c.dict.Add(addName, 0);
            }
            GUI.Label(nText, "Properties");
            Rect addNameR = duplicate(AddBox, 0, 20);
            addName = GUI.TextField(addNameR, addName);
            Rect clearProps = duplicate(addNameR, 0, 20);
            if (GUI.Button(clearProps, "Clear Properties"))
            {
                c.dict.Clear();
            }
            Rect pT = duplicate(clearProps, 0, 30);
            GUI.Label(pT, "Properties :");
            if (c != null)
            {
                if (c.dict != null && c.dict.keys.Count > 0)
                {
                    List <string> keys = c.dict.keys;
                    for (int i = 0; i < keys.Count; i++)
                    {
                        Rect pTT = o(pT, 0, 34 * (i + 1) + 10, 70, 20);
                        Rect bT  = o(pTT, 0, -5, 170, 30);
                        GUI.Box(bT, "");
                        GUI.Label(pTT, keys[i]);
                        Rect vT   = o(pTT, 75, 0, 30, 20);
                        Rect bTT  = o(vT, 35, 0, 20, 20);
                        Rect bTTT = o(bTT, 25, 0, 20, 20);
                        if (!c.dict.setInStone)
                        {
                            c.dict.SetValue(keys [i], EditorGUI.FloatField(vT, c.dict.value(keys [i])));
                        }
                        else
                        {
                            GUI.Label(vT, c.dict.value(keys [i]).ToString());
                        }
                        if (GUI.Button(bTT, "-"))
                        {
                            c.dict.Remove(keys [i]);
                        }
                        if (GUI.Button(bTTT, "[]"))
                        {
                            c.dict.setInStone = !c.dict.setInStone;
                        }
                        continue;
                    }
                }
            }
        }
    }
예제 #6
0
    private void NodeAdderPanel()
    {
        nAdder = o(main, 0, w.height - 30, main.width, 30);
        GUI.Box(nAdder, "");
        Rect bNode = o(nAdder, 20, 5, 100, 20);

        if (GUI.Button(bNode, "Begin/Gate"))
        {
            if (c != null)
            {
                BNode n = new BNode();
                c.nodes.Add((CNode)n);
                CNode newN = c.nodes.nodes [c.nodes.nodes.Count - 1];
                //c.nodes.nodes [c.nodes.nodes.Count - 1].chat = c;
                c.nodes.nodes [c.nodes.nodes.Count - 1].name = "Gate";
                for (int i = 0; i < c.dict.keys.Count; i++)
                {
                    CChecker checkNew = new CChecker();
                    checkNew.checkType    = CChecker.propertyCheck.NA;
                    checkNew.propertyName = c.dict.keys [i];
                    checkNew.value        = c.dict.value(c.dict.keys [i]);
                    newN.checkers.Add(checkNew);
                }
            }
        }
        Rect playerNode = o(nAdder, 140, 5, 100, 20);
        Rect npcNode    = duplicate(playerNode, 120, 0);

        if (GUI.Button(playerNode, "Player Response"))
        {
            if (c != null)
            {
//				ScriptableObject n = ScriptableObject.CreateInstance<CPlayerWindow> ();
                c.nodes.Add((CNode) new CPlayerWindow());
                CNode newN = c.nodes.nodes [c.nodes.nodes.Count - 1];
                //c.nodes.nodes [c.nodes.nodes.Count - 1].chat = c;
                c.nodes.nodes [c.nodes.nodes.Count - 1].name = "Player Node";

                for (int i = 0; i < c.dict.keys.Count; i++)
                {
                    CEffector ef = new CEffector();
                    ef.s    = c.dict.keys [i];
                    ef.f    = c.dict.value(c.dict.keys [i]);
                    ef.type = CEffector.operationType.NA;
                    newN.effectors.Add(ef);
                }
            }
        }
        if (GUI.Button(npcNode, "NPC Response"))
        {
            if (c != null)
            {
                c.nodes.Add((CNode) new CNPCWindow());
                CNode newN = c.nodes.nodes [c.nodes.nodes.Count - 1];
                //c.nodes.nodes [c.nodes.nodes.Count - 1].chat = c;
                c.nodes.nodes [c.nodes.nodes.Count - 1].name = "NPC";

                for (int i = 0; i < c.dict.keys.Count; i++)
                {
                    CEffector ef = new CEffector();
                    ef.s    = c.dict.keys [i];
                    ef.f    = c.dict.value(c.dict.keys [i]);
                    ef.type = CEffector.operationType.NA;
                    newN.effectors.Add(ef);
                }
            }
        }
        //	Rect sel = duplicate (npcNode, 120, 0);
        //	c = (NPC_Chat)EditorGUI.ObjectField (sel, c, typeof(NPC_Chat));
        Rect clear = duplicate(npcNode, 120, 0);

        if (GUI.Button(clear, "Clear"))
        {
            if (c != null)
            {
                c.nodes.nodes.Clear();
            }
            deleted.Clear();
        }
        Rect showAll = duplicate(clear, 120, 0);

        if (GUI.Button(showAll, "Show All"))
        {
            if (c != null)
            {
                for (int i = 0; i < c.nodes.nodes.Count; i++)
                {
                    c.nodes.nodes [i].hidden = false;
                }
            }
        }
    }
예제 #7
0
    private void Enumming()
    {
        Event e = Event.current;

        if (e != null && e.keyCode != KeyCode.None && e.type == EventType.KeyUp && e.alt == true)
        {
            if (e.keyCode == KeyCode.A)
            {
                if (c != null)
                {
                    BNode n = new BNode();
                    c.nodes.Add((CNode)n);
                    CNode newN = c.nodes.nodes [c.nodes.nodes.Count - 1];
                    //c.nodes.nodes [c.nodes.nodes.Count - 1].chat = c;
                    c.nodes.nodes [c.nodes.nodes.Count - 1].name = "Gate";
                    newN.pos.position = e.mousePosition;
                    for (int i = 0; i < c.dict.keys.Count; i++)
                    {
                        CChecker checkNew = new CChecker();
                        checkNew.checkType    = CChecker.propertyCheck.NA;
                        checkNew.propertyName = c.dict.keys [i];
                        checkNew.value        = c.dict.value(c.dict.keys [i]);
                        newN.checkers.Add(checkNew);
                    }
                }
            }

            if (e.keyCode == KeyCode.S)
            {
                if (c != null)
                {
                    //				ScriptableObject n = ScriptableObject.CreateInstance<CPlayerWindow> ();
                    c.nodes.Add((CNode) new CPlayerWindow());
                    CNode newN = c.nodes.nodes [c.nodes.nodes.Count - 1];
                    //c.nodes.nodes [c.nodes.nodes.Count - 1].chat = c;
                    c.nodes.nodes [c.nodes.nodes.Count - 1].name = "Player Node";
                    newN.pos.position = e.mousePosition;
                    for (int i = 0; i < c.dict.keys.Count; i++)
                    {
                        CEffector ef = new CEffector();
                        ef.s    = c.dict.keys [i];
                        ef.f    = c.dict.value(c.dict.keys [i]);
                        ef.type = CEffector.operationType.NA;
                        newN.effectors.Add(ef);
                    }
                }
            }

            if (e.keyCode == KeyCode.D)
            {
                if (c != null)
                {
                    c.nodes.Add((CNode) new CNPCWindow());
                    CNode newN = c.nodes.nodes [c.nodes.nodes.Count - 1];
                    //c.nodes.nodes [c.nodes.nodes.Count - 1].chat = c;
                    c.nodes.nodes [c.nodes.nodes.Count - 1].name = "NPC";
                    newN.pos.position = e.mousePosition;
                    for (int i = 0; i < c.dict.keys.Count; i++)
                    {
                        CEffector ef = new CEffector();
                        ef.s    = c.dict.keys [i];
                        ef.f    = c.dict.value(c.dict.keys [i]);
                        ef.type = CEffector.operationType.NA;
                        newN.effectors.Add(ef);
                    }
                }
            }
        }
    }
예제 #8
0
 public virtual void RemoveCheck(CChecker c)
 {
     return;
 }
예제 #9
0
 public virtual void AddCheck(CChecker c)
 {
     return;
 }