Exemple #1
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);
            }
        }
Exemple #2
0
        public StoryTaskUpdate GetUpdate()
        {
            // just returning data update now.
            // in fact, our point id is still there and should go here

            // get data update and expand into taskupdate
            StoryTaskUpdate update = new StoryTaskUpdate(GetDataUpdate());

            // add task update specifics that the dataobject doesn't know about.
            update.pointID = PointID;

            return(update);
        }
Exemple #3
0
 public void ApplyUpdate(StoryTaskUpdate update, bool changeMask = false)
 {
     // apply data changes. changemask isn't really in use right now, to be used for having multiple clients...
     ApplyDataUpdate(update, "");
 }