Exemple #1
0
        private void RestoreRaw(GameStateStepRestoreCheckpointEntry restoreDatas)
        {
            // Debug.Log($"Nova: Restoring checkpoint from varhash = {restoreDatas.variables.hash}");
            Assert.IsNotNull(restoreDatas);

            stepNumFromLastCheckpoint = 0;
            restrainCheckpoint        = restoreDatas.restrainCheckpointNum;
            forceCheckpoint           = false;

            variables.CopyFrom(restoreDatas.variables);

            foreach (var restorable in from entry in restorables
                     orderby(entry.Value as IPrioritizedRestorable)?.priority ?? RestorablePriority.Normal descending
                     select entry)
            {
                try
                {
                    var restoreData = restoreDatas[restorable.Key];
                    restorable.Value.Restore(restoreData);
                }
                catch (KeyNotFoundException)
                {
                    Debug.LogErrorFormat("Nova: Key {0} not found in restoreDatas. Check if the restorable name " +
                                         "has changed. If that is true, try clear all checkpoint " +
                                         "files, or undo the change of the restorable name.", restorable.Key);
                }
            }
        }
Exemple #2
0
        private void RestoreCheckpoint(GameStateCheckpoint entry)
        {
            this.RuntimeAssert(entry != null, "Checkpoint is null");

            stepNumFromLastCheckpoint = 0;
            restrainCheckpointNum     = entry.restrainCheckpointNum;
            forceCheckpoint           = false;

            variables.CopyFrom(entry.variables);

            foreach (var pair in
                     from pair in restorables
                     orderby(pair.Value as IPrioritizedRestorable)?.priority ?? RestorablePriority.Normal descending
                     select pair)
            {
                try
                {
                    pair.Value.Restore(entry.restoreDatas[pair.Key]);
                }
                catch (KeyNotFoundException)
                {
                    Debug.LogWarningFormat("Nova: Key {0} not found in restoreDatas. Check if the restorable name " +
                                           "has changed. If that is true, try clear all checkpoint " +
                                           "files, or undo the change of the restorable name.", pair.Key);
                }
            }
        }
 static int CopyFrom(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Nova.Variables obj  = (Nova.Variables)ToLua.CheckObject <Nova.Variables>(L, 1);
         Nova.Variables arg0 = (Nova.Variables)ToLua.CheckObject <Nova.Variables>(L, 2);
         obj.CopyFrom(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }