Exemplo n.º 1
0
        private static void ApplyCounterQuestConditionProxyData(CounterQuestCondition counterQuestCondition, string s)
        {
            if (counterQuestCondition == null || s == null)
            {
                return;
            }
            var fields = s.Split(';');

            if (fields.Length < 5)
            {
                return;
            }
            counterQuestCondition.counterValueMode = (CounterValueConditionMode)SafeConvert.ToInt(fields[0]);
            var valueType = (QuestNumber.ValueType)SafeConvert.ToInt(fields[1]);

            switch (valueType)
            {
            case QuestNumber.ValueType.Literal:
                counterQuestCondition.requiredCounterValue = new QuestNumber(SafeConvert.ToInt(fields[2]));
                break;

            case QuestNumber.ValueType.CounterValue:
            case QuestNumber.ValueType.CounterMinValue:
            case QuestNumber.ValueType.CounterMaxValue:
                counterQuestCondition.requiredCounterValue              = new QuestNumber();
                counterQuestCondition.requiredCounterValue.valueType    = valueType;
                counterQuestCondition.requiredCounterValue.counterIndex = SafeConvert.ToInt(fields[3]);
                break;

            default:
                counterQuestCondition.requiredCounterValue = new QuestNumber();
                break;
            }
            counterQuestCondition.counterIndex = SafeConvert.ToInt(fields[4]);
        }
Exemplo n.º 2
0
        public CounterQuestCondition AddCounterCondition(QuestNode node, StringField counterName, CounterValueConditionMode conditionMode, QuestNumber requiredValue)
        {
            var condition = CounterQuestCondition.CreateInstance <CounterQuestCondition>();

            condition.name                 = "counterCondition";
            condition.counterIndex         = quest.GetCounterIndex(counterName);
            condition.counterValueMode     = conditionMode;
            condition.requiredCounterValue = requiredValue;
            node.conditionSet.conditionList.Add(condition);
            return(condition);
        }
Exemplo n.º 3
0
 private static string GetCounterQuestConditionProxyData(CounterQuestCondition counterQuestCondition)
 {
     return((int)counterQuestCondition.counterValueMode + ";" + (int)counterQuestCondition.requiredCounterValue.valueType + ";" +
            counterQuestCondition.requiredCounterValue.literalValue + ";" + counterQuestCondition.requiredCounterValue.counterIndex + ";" +
            counterQuestCondition.counterIndex);
 }