예제 #1
0
        /// <summary>
        /// Updates the tree node status.
        /// </summary>
        /// <param name="n">The n.</param>
        public static void UpdateTreeNodeStatus(TreeNode n)
        {
            Task t = (Task)n.Tag;

            if (t != null)
            {
                Task.TaskState state = t.State;
                if (state == Task.TaskState.Idle)
                {
                    n.BackColor = Color.White;
                }
                else if (state == Task.TaskState.Done)
                {
                    n.BackColor = Color.Blue;
                }
                else if (state == Task.TaskState.Active)
                {
                    n.BackColor = Color.Green;
                }
                else if (state == Task.TaskState.Want)
                {
                    n.BackColor = Color.Yellow;
                }
            }

            TreeNode child = n.FirstNode;

            while (child != null)
            {
                UpdateTreeNodeStatus(child);
                child = child.NextNode;
            }
        }
예제 #2
0
    void AddDisplay()
    {
        switch (TypeOfProgress)
        {
        case ProgressType.None:
            rect.size = new Vector2(200, 100);
            break;

        case ProgressType.ProgressPoint:
            rect.size = new Vector2(200, 155);
            CheckPoint.ProgressName = EditorGUI.TextField(new Rect(rect.position + new Vector2(25, 90), new Vector2(150, 20)), CheckPoint.ProgressName);
            CheckPoint.TypeID       = (PointTypes)EditorGUI.EnumPopup(new Rect(rect.position + new Vector2(25, 115), new Vector2(150, 20)), CheckPoint.TypeID);
            ProgressPointDisplay();
            break;

        case ProgressType.Objective:
            rect.size    = new Vector2(200, 190);
            TaskID       = EditorGUI.TextField(new Rect(rect.position + new Vector2(25, 115), new Vector2(150, 20)), TaskID);
            NewTaskState = (Task.TaskState)EditorGUI.EnumPopup(new Rect(rect.position + new Vector2(25, 140), new Vector2(150, 20)), NewTaskState);
            //SendNoification = EditorGUI.ToggleLeft(new Rect(rect.position + new Vector2(25, 160), new Vector2(150, 15)), "Send Notification Event", SendNoification);
            break;

        case ProgressType.CG:
            rect.size = new Vector2(200, 200);
            Image     = EditorGUI.ObjectField(new Rect(rect.position + new Vector2(25, 115), new Vector2(150, 50)), Image, typeof(Sprite), allowSceneObjects: true) as Sprite;
            //SendNoification = EditorGUI.ToggleLeft(new Rect(rect.position + new Vector2(25, 170), new Vector2(150, 15)), "Send Notification Event", SendNoification);
            break;

        default:
            Debug.LogError("Unrecognized Option");
            break;
        }
    }
예제 #3
0
    public static int MakeProgress(JsonData data)
    {
        int ty = (int)data["TypeOfProgress"];

        ProgressType type = (ProgressType)ty;

        int NextID = -1;

        switch (type)
        {
        case ProgressType.None:
            break;

        case ProgressType.ProgressPoint:

            ProgressPoint CheckToMatch = new ProgressPoint(data["CheckToMatch"][0]);

            Game.current.Progress.UpdateProgress(CheckToMatch.ProgressName, CheckToMatch);
            NextID = (int)data["NextID"];
            break;

        case ProgressType.CG:
            Sprite Image = null;
            if (data["ImageSlug"] != null)
            {
                Image = Resources.Load <Sprite>("Sprites/" + (string)data["ImageSlug"]);

                Game.current.Memory.UnlockImage(Image);
            }
            break;

        case ProgressType.Objective:
            string   num  = (string)data["TaskNumber"];
            string[] id   = num.Split('.');
            int      num1 = Convert.ToInt32(id[0]);
            int      num2 = -1;
            if (id.Length > 1)
            {
                num2 = Convert.ToInt32(id[1]);
            }

            int            state        = (int)data["TaskState"];
            Task.TaskState NewTaskState = (Task.TaskState)state;
            Game.current.Progress.UpdateTask(num1, NewTaskState, num2);
            break;

        default:
            Debug.LogError("Unrecognized Option");
            break;
        }



        return(NextID);
    }
예제 #4
0
    public ChangeNode(Vector2 position, float width, float height, GUIStyle nodeStyle, GUIStyle selectedStyle, GUIStyle inPointStyle, GUIStyle outPointStyle, Action <ConnectionPoint> OnClickInPoint, Action <ConnectionPoint> OnClickOutPoint, Action <BaseNode> OnClickRemoveNode, Action <BaseNode> OnClickDuplicateNode, int NodeID) : base(position, width, height, nodeStyle, selectedStyle, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, OnClickDuplicateNode)
    {
        ID             = NodeID;
        NextID         = -1;
        TypeID         = NodeTypes.ChangeNode;
        TypeOfProgress = ProgressType.None;
        CheckPoint     = new ProgressPoint();

        NoteTitle    = "";
        Image        = null;
        TaskID       = "0.0";
        NewTaskState = Task.TaskState.Unstarted;
    }
예제 #5
0
    //a null node
    public ProgressNode(Vector2 position, float width, float height, GUIStyle nodeStyle, GUIStyle selectedStyle, GUIStyle inPointStyle, GUIStyle outPointStyle, Action <ConnectionPoint> OnClickInPoint, Action <ConnectionPoint> OnClickOutPoint, Action <BaseNode> OnClickRemoveNode, Action <BaseNode> OnClickDuplicateNode, int NodeID) : base(position, width, height, nodeStyle, selectedStyle, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, OnClickDuplicateNode)
    {
        inPoint        = new ProgressionConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint);
        outPoint       = new ProgressionConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint);
        BranchOutPoint = new ProgressionConnectionPoint(this, ConnectionPointType.Branch, outPointStyle, OnClickOutPoint);

        TypeOfProgress = ProgressType.None;
        ID             = NodeID;
        PassID         = -1;
        FailID         = -1;
        TypeID         = NodeTypes.ProgressNode;
        CheckPoint     = new ProgressPoint();

        Current = false;

        NoteTitle    = "";
        Image        = null;
        TaskNumber   = 0;
        NewTaskState = Task.TaskState.Unstarted;
        BeatName     = "";
        DreamName    = "";
    }
예제 #6
0
    public void UpdateTask(int Number, Task.TaskState newState, int SubTask = -1)
    {
        if (Objectives.Count <= Number)
        {
            return;
        }

        if (SubTask != -1 && Objectives[Number].SubTasks.Count > SubTask)
        {
            Objectives[Number].SubTasks[SubTask].SetState(newState);
            if (Objectives[Number].SubtasksComplete())
            {
                Objectives[Number].SetState(Task.TaskState.Success);
            }
            if (Objectives[Number].SubtasksFailure())
            {
                Objectives[Number].SetState(Task.TaskState.Failed);
            }
        }
        else
        {
            if (newState != Task.TaskState.Unstarted && Objectives[Number].GetState() == Task.TaskState.Unstarted)
            {
                if (!(newState == Task.TaskState.InProgress && Objectives[Number].Hidden))
                {
                    ChronologicalObjectives.Add(Objectives[Number]);
                }
            }

            Objectives[Number].SetState(newState);
        }



        //send any system updating events here
    }
예제 #7
0
    public ChangeNode(Vector2 position, float width, float height, GUIStyle nodeStyle, GUIStyle selectedStyle, GUIStyle inPointStyle, GUIStyle outPointStyle, Action <ConnectionPoint> OnClickInPoint, Action <ConnectionPoint> OnClickOutPoint, Action <BaseNode> OnClickRemoveNode, Action <BaseNode> OnClickDuplicateNode, JsonData data) : base(position, width, height, nodeStyle, selectedStyle, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, OnClickDuplicateNode)
    {
        TypeID = NodeTypes.ChangeNode;

        if (data.Keys.Contains("color"))
        {
            ChangeColor((int)data["color"]);
        }


        ID = (int)data["ID"];

        NextID = (int)data["NextID"];

        title = (string)data["title"];

        if (data.Keys.Contains("TypeOfProgress"))
        {
            int ty = (int)data["TypeOfProgress"];
            TypeOfProgress = (ProgressType)ty;
        }
        else
        {
            TypeOfProgress = ProgressType.ProgressPoint;
        }

        if (data.Keys.Contains("CheckToMatch"))
        {
            CheckPoint = new ProgressPoint(data["CheckToMatch"][0]);
        }
        else
        {
            CheckPoint = new ProgressPoint();
        }

        if (data.Keys.Contains("NoteTitle"))
        {
            NoteTitle = (string)data["NoteTitle"];
        }
        else
        {
            NoteTitle = "";
        }

        if (data.Keys.Contains("PhoneImageSlug") && data["PhoneImageSlug"] != null)
        {
            Image = Resources.Load <Sprite>("Sprites/" + (string)data["PhoneImageSlug"]);
        }

        if (data.Keys.Contains("TaskNumber"))
        {
            TaskID = (string)data["TaskNumber"];
        }
        else
        {
            TaskID = "0";
        }

        if (data.Keys.Contains("TaskState"))
        {
            int state = (int)data["TaskState"];
            NewTaskState = (Task.TaskState)state;
        }
        else
        {
            NewTaskState = Task.TaskState.Unstarted;
        }

        if (data.Keys.Contains("Battery"))
        {
            Battery = (float)(double)data["Battery"];
        }
        else
        {
            Battery = 0;
        }

        if (data.Keys.Contains("Drain"))
        {
            Drain = (float)(double)data["Drain"];
        }
        else
        {
            Drain = 0;
        }


        if (data.Keys.Contains("InventoryItem"))
        {
            InventoryItemName = (string)data["InventoryItem"];
        }
        else
        {
            InventoryItemName = "";
        }

        if (data.Keys.Contains("Notify"))
        {
            SendNoification = (bool)data["Notify"];
        }
        else
        {
            SendNoification = false;
        }
    }
예제 #8
0
    public ProgressNode(Vector2 position, float width, float height, GUIStyle nodeStyle, GUIStyle selectedStyle, GUIStyle inPointStyle, GUIStyle outPointStyle, Action <ConnectionPoint> OnClickInPoint, Action <ConnectionPoint> OnClickOutPoint, Action <BaseNode> OnClickRemoveNode, Action <BaseNode> OnClickDuplicateNode, JsonData data) : base(position, width, height, nodeStyle, selectedStyle, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, OnClickDuplicateNode)
    {
        inPoint        = new ProgressionConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint);
        outPoint       = new ProgressionConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint);
        BranchOutPoint = new ProgressionConnectionPoint(this, ConnectionPointType.Branch, outPointStyle, OnClickOutPoint);


        if (data.Keys.Contains("color"))
        {
            ChangeColor((int)data["color"]);
        }

        TypeID = NodeTypes.ProgressNode;

        if (data.Keys.Contains("TypeOfProgress"))
        {
            int ty = (int)data["TypeOfProgress"];
            TypeOfProgress = (ProgressType)ty;
        }
        else
        {
            TypeOfProgress = ProgressType.ProgressPoint;
        }


        ID = (int)data["ID"];

        PassID = (int)data["PassID"];
        FailID = (int)data["FailID"];

        title = (string)data["title"];

        //CheckToMatch = (string)data["CheckToMatch"];
        //MatchValue = (bool)data["MatchValue"];

        if (data.Keys.Contains("CheckToMatch"))
        {
            CheckPoint = new ProgressPoint(data["CheckToMatch"][0]);
        }
        else
        {
            CheckPoint = new ProgressPoint();
        }



        if (data.Keys.Contains("Comparison"))
        {
            int com = (int)data["Comparison"];
            Compare = (ValueCompare)com;
        }
        else
        {
            Compare = ValueCompare.EqualTo;
        }



        if (data.Keys.Contains("Slug") && data["Slug"] != null)
        {
            InventoryMatch = Resources.Load("Sprites/" + (string)data["Slug"]) as Texture2D;
        }



        if (data.Keys.Contains("NoteTitle"))
        {
            NoteTitle = (string)data["NoteTitle"];
        }
        else
        {
            NoteTitle = "";
        }



        if (data.Keys.Contains("PhoneImageSlug") && data["PhoneImageSlug"] != null)
        {
            Image = Resources.Load <Sprite>("Sprites/" + (string)data["PhoneImageSlug"]);
        }

        if (data.Keys.Contains("Current"))
        {
            Current = (bool)data["Current"];
        }
        else
        {
            Current = false;
        }

        if (data.Keys.Contains("TaskNumber"))
        {
            TaskNumber = (int)data["TaskNumber"];
        }
        else
        {
            TaskNumber = 0;
        }

        if (data.Keys.Contains("TaskState"))
        {
            int state = (int)data["TaskState"];
            NewTaskState = (Task.TaskState)state;
        }
        else
        {
            NewTaskState = Task.TaskState.Unstarted;
        }

        if (data.Keys.Contains("Battery"))
        {
            Battery = (int)data["Battery"];
        }
        else
        {
            Battery = 0;
        }

        if (data.Keys.Contains("Drain"))
        {
            Drain = (float)(double)data["Drain"];
        }
        else
        {
            Drain = 0;
        }

        if (data.Keys.Contains("BeatName"))
        {
            BeatName = (string)data["BeatName"];
        }
        else
        {
            BeatName = "";
        }


        if (data.Keys.Contains("Previous"))
        {
            PreviousScene = (bool)data["Previous"];
        }
        else
        {
            PreviousScene = false;
        }

        if (data.Keys.Contains("Date"))
        {
            int date = (int)data["Date"];
            Date = (DayOfWeek)date;
        }
        else
        {
            Date = DayOfWeek.Monday;
        }

        if (data.Keys.Contains("Dream"))
        {
            DreamName = (string)data["Dream"];
        }
        else
        {
            DreamName = "";
        }
    }