示例#1
0
    public bool CheckProgress(ProgressPoint key)
    {
        if (!ProgressBook.ContainsKey(key.ProgressName))
        {
            return(false);
        }


        switch (ProgressBook[key.ProgressName].TypeID)
        {
        case PointTypes.Flag:
            return(key.BoolValue == ProgressBook[key.ProgressName].BoolValue);

        case PointTypes.Float:
            return(TextParser.CompareValues(key.compare, ProgressBook[key.ProgressName].FloatValue, key.FloatValue));

        case PointTypes.Integer:
            return(TextParser.CompareValues(key.compare, ProgressBook[key.ProgressName].IntValue, key.IntValue));

        case PointTypes.String:
            return(ProgressBook[key.ProgressName].StringValue == key.StringValue);

        default:
            break;
        }

        return(false);
    }
示例#2
0
    public void AddPoint(string key, ProgressPoint value)
    {
        if (Contains(key))
        {
            return;
        }

        ProgressBook.Add(key, value);
    }
示例#3
0
 public ProgressPoint(ProgressPoint copy_)
 {
     ProgressName = copy_.ProgressName;
     TypeID       = copy_.TypeID;
     StringValue  = copy_.StringValue;
     BoolValue    = copy_.BoolValue;
     IntValue     = copy_.IntValue;
     FloatValue   = copy_.FloatValue;
     compare      = copy_.compare;
 }
示例#4
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);
    }
示例#5
0
    public void UpdateProgress(string _key, ProgressPoint change)
    {
        if (!ProgressBook.ContainsKey(_key))
        {
            return;
        }

        switch (ProgressBook[_key].TypeID)
        {
        case PointTypes.Flag:
            ProgressBook[_key].BoolValue = change.BoolValue;
            break;

        case PointTypes.Float:
            if (change.FloatValue != 0)
            {
                ProgressBook[_key].FloatValue = change.FloatValue;
            }
            else
            {
                ProgressBook[_key].FloatValue = 0;
            }
            break;

        case PointTypes.Integer:
            if (change.IntValue != 0)
            {
                ProgressBook[_key].IntValue = change.IntValue;
            }
            else
            {
                ProgressBook[_key].IntValue = 0;
            }
            break;

        case PointTypes.String:
            if (change.StringValue != null)
            {
                ProgressBook[_key].StringValue = change.StringValue;
            }
            else
            {
                ProgressBook[_key].StringValue = "";
            }
            break;

        default:
            break;
        }


        UpdatePlotLines();
    }
示例#6
0
    public Beat(Beat copy, ProgressSystem progress)
    {
        Points = new List <ProgressPoint>();

        for (int i = 0; i < copy.Points.Count; ++i)
        {
            ProgressPoint point = new ProgressPoint(copy.Points[i]);

            Points.Add(point);
            progress.AddPoint(point.ProgressName, point);
        }
    }
示例#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, 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;
    }
示例#8
0
    //editor contructor
    public Beat(JsonData beatData)
    {
        PlotName   = (string)beatData["PlotName"];
        BeatName   = (string)beatData["BeatName"];
        BeatNumber = (int)beatData["BeatNumber"];

        Points = new List <ProgressPoint>();

        for (int i = 0; i < beatData["Point"].Count; ++i)
        {
            string        boolName = (string)beatData["Point"][i]["Name"];
            PointTypes    type     = (PointTypes)(int)beatData["Point"][i]["Type"];
            ProgressPoint point    = new ProgressPoint(boolName, type);
            Points.Add(point);
        }
    }
示例#9
0
    public static int CheckProgress(JsonData data)
    {
        int NextID = -1;

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

        if (Game.current.Progress.CheckProgress(CheckToMatch))
        {
            NextID = (int)data["PassID"];
        }
        else
        {
            NextID = (int)data["FailID"];
        }

        return(NextID);
    }
示例#10
0
    public void NewDay()
    {
        Progress.ResetDay();

        Day += 1;
        //update the day in the progression system
        var point = new ProgressPoint("Day", PointTypes.Integer);

        point.IntValue = Day;

        Progress.UpdateProgress("Day", point);

        //checks if any special conditions have occured, to change rooms or anything.
        // prolly do this in scene checks, not here

        //cast new day event
        Space.DispatchEvent(Events.NewDay);
    }
示例#11
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    = "";
    }
示例#12
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;
        }
    }
示例#13
0
 public static void Set(ProgressPoint pp, bool value)
 {
     _points[(int)pp] = (byte)(value ? 1 : 0);
 }
示例#14
0
 public static bool Evaluate(ProgressPoint pp)
 {
     return(_points[(int)pp] == 1);
 }
示例#15
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 = "";
        }
    }