コード例 #1
0
 public void CopyFrom(Quest quest)
 {
     if (quest == null)
     {
         Debug.LogWarning("Quest Machine: QuestProxy.CopyFrom source quest is null.");
         return;
     }
     isInstance            = quest.isInstance;
     id                    = StringField.GetStringValue(quest.id);
     displayName           = StringField.GetStringValue(quest.title);
     iconPath              = QuestMachine.GetImagePath(quest.icon);
     group                 = StringField.GetStringValue(quest.group);
     labels                = StringFieldsToStrings(quest.labels);
     giver                 = StringField.GetStringValue(quest.questGiverID);
     isTrackable           = quest.isTrackable;
     track                 = quest.showInTrackHUD;
     isAbandonable         = quest.isAbandonable;
     rememberIfAbandoned   = quest.rememberIfAbandoned;
     autostartConditionSet = new QuestConditionSetProxy(quest.autostartConditionSet);
     offerConditionSet     = new QuestConditionSetProxy(quest.offerConditionSet);
     offerUnmetContentList = QuestContentProxy.NewArray(quest.offerConditionsUnmetContentList);
     offerContentList      = QuestContentProxy.NewArray(quest.offerContentList);
     maxTimes              = quest.maxTimes;
     timesAccepted         = quest.timesAccepted;
     cooldownSecs          = quest.cooldownSeconds;
     cooldownSecsRemain    = quest.cooldownSecondsRemaining;
     state                 = quest.GetState();
     stateInfoList         = QuestStateInfoProxy.NewArray(quest.stateInfoList);
     counterList           = QuestCounterProxy.NewArray(quest.counterList);
     nodeList              = QuestNodeProxy.NewArray(quest.nodeList);
     tags                  = new TagDictionary(quest.tagDictionary);
     indicators            = QuestIndicatorStateRecordProxy.NewArray(quest.indicatorStates);
     goalEntity            = quest.goalEntityTypeName;
 }
コード例 #2
0
        private QuestContentProxy[] GetNewArrayForCategory(QuestStateInfo stateInfo, QuestContentCategory category)
        {
            var index = (int)category;

            return((0 <= index && index < stateInfo.categorizedContentList.Count)
                ? QuestContentProxy.NewArray(stateInfo.categorizedContentList[index].contentList)
                : new QuestContentProxy[0]);
        }
コード例 #3
0
 public void CopyTo(QuestStateInfo stateInfo)
 {
     if (stateInfo == null)
     {
         Debug.LogWarning("Quest Machine: QuestStateInfoProxy.CopyTo destination is null.");
         return;
     }
     stateInfo.actionList             = QuestActionProxy.CreateList(acn);
     stateInfo.categorizedContentList = new List <QuestContentSet>();
     for (int i = 0; i < QuestStateInfo.NumContentCategories; i++)
     {
         var contentSet = QuestContentProxy.CreateContentSet(GetContentListProxy((QuestContentCategory)i));
         stateInfo.categorizedContentList.Add(contentSet);
     }
 }
コード例 #4
0
        public static QuestContentProxy[] NewArray(List <QuestContent> contentList)
        {
            if (contentList == null)
            {
                Debug.LogWarning("Quest Machine: QuestContentProxy.NewArray source is null.");
                return(new QuestContentProxy[0]);
            }
            var array = new QuestContentProxy[contentList.Count];

            for (int i = 0; i < array.Length; i++)
            {
                array[i] = new QuestContentProxy(contentList[i]);
            }
            return(array);
        }
コード例 #5
0
 public void CopyTo(Quest quest)
 {
     if (quest == null)
     {
         Debug.LogWarning("Quest Machine: QuestProxy.CopyTo destination quest is null.");
         return;
     }
     quest.isInstance                      = isInstance;
     quest.id                              = new StringField(id);
     quest.title                           = new StringField(displayName);
     quest.group                           = new StringField(group);
     quest.labels                          = StringsToStringFields(labels);
     quest.icon                            = QuestMachine.GetImage(iconPath);
     quest.questGiverID                    = new StringField(giver);
     quest.isTrackable                     = isTrackable;
     quest.showInTrackHUD                  = track;
     quest.isAbandonable                   = isAbandonable;
     quest.rememberIfAbandoned             = rememberIfAbandoned;
     quest.autostartConditionSet           = autostartConditionSet.CreateConditionSet();
     quest.offerConditionSet               = offerConditionSet.CreateConditionSet();
     quest.offerConditionsUnmetContentList = QuestContentProxy.CreateList(offerUnmetContentList);
     quest.offerContentList                = QuestContentProxy.CreateList(offerContentList);
     quest.maxTimes                        = maxTimes;
     quest.timesAccepted                   = timesAccepted;
     quest.UpdateCooldown();
     quest.cooldownSeconds          = cooldownSecs;
     quest.cooldownSecondsRemaining = cooldownSecsRemain;
     quest.stateInfoList            = QuestStateInfoProxy.CreateList(stateInfoList);
     quest.counterList        = QuestCounterProxy.CreateList(counterList);
     quest.nodeList           = QuestNodeProxy.CreateList(nodeList);
     quest.tagDictionary      = new TagDictionary(tags);
     quest.indicatorStates    = QuestIndicatorStateRecordProxy.ArrayToDictionary(indicators);
     quest.goalEntityTypeName = goalEntity;
     quest.SetRuntimeReferences();
     quest.SetState(state, false);
     QuestNodeProxy.CopyStatesTo(nodeList, quest);
 }
コード例 #6
0
 public override void OnAfterProxyDeserialization()
 {
     base.OnAfterProxyDeserialization();
     contentList = QuestContentProxy.CreateList(m_contentListSerializationProxy);
     m_contentListSerializationProxy = null; // After deserializing, free proxy memory.
 }
コード例 #7
0
 public override void OnBeforeProxySerialization()
 {
     base.OnBeforeProxySerialization();
     m_contentListSerializationProxy = QuestContentProxy.NewArray(contentList);
 }