public static KeyValuePair <Item, short> MakeItemAmountPair(ItemAmount source) { if (source.item == null) { return(new KeyValuePair <Item, short>()); } return(new KeyValuePair <Item, short>(source.item, source.amount)); }
protected override void UpdateData() { bool isComplete = false; switch (QuestTask.taskType) { case QuestTaskType.KillMonster: MonsterCharacterAmount monsterCharacterAmount = QuestTask.monsterCharacterAmount; string monsterTitle = monsterCharacterAmount.monster == null?LanguageManager.GetUnknowTitle() : monsterCharacterAmount.monster.Title; short monsterKillAmount = monsterCharacterAmount.amount; isComplete = Progress >= monsterKillAmount; if (uiTextTaskDescription != null) { uiTextTaskDescription.text = string.Format( isComplete ? LanguageManager.GetText(formatKeyTaskKillMonsterComplete) : LanguageManager.GetText(formatKeyTaskKillMonster), monsterTitle, Progress.ToString("N0"), monsterKillAmount.ToString("N0")); } break; case QuestTaskType.CollectItem: ItemAmount itemAmount = QuestTask.itemAmount; string itemTitle = itemAmount.item == null?LanguageManager.GetUnknowTitle() : itemAmount.item.Title; short itemCollectAmount = itemAmount.amount; isComplete = Progress >= itemCollectAmount; if (uiTextTaskDescription != null) { uiTextTaskDescription.text = string.Format( isComplete ? LanguageManager.GetText(formatKeyTaskCollectItemComplete) : LanguageManager.GetText(formatKeyTaskCollectItem), itemTitle, Progress.ToString("N0"), itemCollectAmount.ToString("N0")); } break; } }