Пример #1
0
        public static StoryTask FindTaskByByLabel(string id)
        {
            StoryTask r = null;

            r = GENERAL.GetTaskForPoint(id);
            return(r);
        }
Пример #2
0
        void ApplyTaskUpdate(StoryTaskUpdate taskUpdate)
        {
            // See if we already have a task on this storypoint.

            StoryTask updateTask = GENERAL.GetTaskForPoint(taskUpdate.pointID);

            if (updateTask == null)
            {
                // Are we client ? -> create the task
                // (If we're the server, we'll ignore updates for tasks we no longer know about)

                if (GENERAL.AUTHORITY == AUTHORITY.LOCAL)
                {
                    // Do we already have a pointer for this storyline?
                    StoryPointer updatePointer = GENERAL.GetStorylinePointerForPointID(taskUpdate.pointID);

                    if (updatePointer == null)
                    {
                        // Create a new pointer
                        updatePointer = new StoryPointer();

                        Log("Created a new pointer for point with ID " + taskUpdate.pointID);
                    }

                    updatePointer.SetStoryPointByID(taskUpdate.pointID);
                    updatePointer.SetScope(SCOPE.GLOBAL);// global because we just got it

                    updateTask = updatePointer.SpawnTask();

                    //updateTask = new StoryTask(taskUpdate.pointID,updatePointer); // global because we just got it
                    Log("Created an instance of global task " + updateTask.Instruction + " id " + updateTask.PointID);

                    //Log("Populated pointer " + updatePointer.currentPoint.StoryLine + " with task " + updateTask.Instruction);

                    updateTask.ApplyUpdate(taskUpdate);


                    // updatePointer.PopulateWithTask(updateTask);


                    List <StoryTask> newTasks = new List <StoryTask>();
                    newTasks.Add(updateTask);


                    if (newTasksEventUnity != null)
                    {
                        newTasksEventUnity.Invoke(newTasks);
                    }
                }
            }
            else
            {
                updateTask.ApplyUpdate(taskUpdate);

                updateTask.scope = SCOPE.GLOBAL;// if a task was local it now becomes global

                Verbose("Applied update to existing task " + updateTask.Instruction);
            }
        }
Пример #3
0
        void ApplyTaskUpdate(TaskUpdateBundled taskUpdate)
        {
            // See if we have a task on this storypoint.

            StoryTask updateTask = GENERAL.GetTaskForPoint(taskUpdate.pointID);


            if (updateTask == null)
            {
                // If not, and we're a client, we create the task.
                // If we're the server, we ignore updates for task we no longer know about.

                if (GENERAL.AUTHORITY == AUTHORITY.LOCAL)
                {
                    updateTask = new StoryTask(taskUpdate.pointID, SCOPE.GLOBAL);
                    updateTask.ApplyUpdateMessage(taskUpdate);

                    Log("Created an instance of global task " + updateTask.Instruction + " id " + updateTask.PointID);

                    if (taskUpdate.pointID != "GLOBALS")
                    {
                        // Now find a pointer.

                        StoryPointer updatePointer = GENERAL.GetStorylinePointerForPointID(taskUpdate.pointID);

                        if (updatePointer == null)
                        {
                            updatePointer = new StoryPointer();

                            Log("Created a new pointer for task " + updateTask.Instruction);
                        }

                        updatePointer.PopulateWithTask(updateTask);

                        Log("Populated pointer " + updatePointer.currentPoint.StoryLine + " with task " + updateTask.Instruction);

                        DistributeTasks(new TaskArgs(updateTask));
                    }
                }
            }
            else
            {
                updateTask.ApplyUpdateMessage(taskUpdate);

                updateTask.scope = SCOPE.GLOBAL;//??

                Verbose("Applied update to existing task " + updateTask.Instruction);
            }
        }