private void CommonAddDemand(QuestDemandItem demandItem) { if (demandItem == null) { LogManager.LogError("GetMissionContinue_Bonus Empty Event Item"); return; } cmpWin.AddItem((uint)demandItem.pItemImpl.GetID(), demandItem.pDemandItem.m_yCount); }
private void parseDemandItem(string DemandItem, ref _MISSION_INFO MissionInfo) { try { if (!DemandItem.Equals("nil")) { MatchCollection matches = StringRegex.Matches(DemandItem); if (matches.Count == 0) { LogManager.LogError("--------------------客户端配置中不存在匹配的需求物品项。--------------------"); } foreach (Match match in matches) { string matchstr = match.Value; string[] DemandItemstr = matchstr.Split(new string[1] { "," }, StringSplitOptions.None); uint itemId = Convert.ToUInt32(FormatString(DemandItemstr[0])); int itemCount = Convert.ToInt32(FormatString(DemandItemstr[1])); CObject_Item pItem = ObjectSystem.Instance.NewItem(itemId); if (pItem == null) { LogManager.LogError("--------------------非法的奖励物品ID: " + itemId + "--------------------"); } pItem.SetNumber(itemCount); CActionSystem.Instance.UpdateAction_FromItem(pItem); QuestDemandItem newDemandItem = new QuestDemandItem(); newDemandItem.pDemandItem = new SMissionBonusItem(); newDemandItem.pDemandItem.m_uItemID = itemId; newDemandItem.pDemandItem.m_yCount = itemCount; pItem.SetTypeOwner(ITEM_OWNER.IO_QUESTVIRTUALITEM); newDemandItem.pItemImpl = pItem; MissionInfo.m_vecQuestDemandItem.Add(newDemandItem); } } } catch (Exception ex) { CDataBaseSystem.StrError += "--------------------parseDemandItem方法出错。--------------------"; CDataBaseSystem.StrError += ex.ToString(); throw new Exception(CDataBaseSystem.StrError); } }
private void MissionContinueUpdate(bool missIsDone) { cmpWin.CleanAll(); string parseRes = ""; int txtNum = CUIDataPool.Instance.m_pMissionDemandInfo.m_yTextCount; for (int i = 0; i < txtNum; i++) { int index; string txt = CUIDataPool.Instance.m_pMissionDemandInfo.m_aText[i].m_szString; if (UIString.Instance.ParseAcceptQuest(txt, out index)) { string mark = "#{M_MUBIAO}"; string TargetText = txt.Substring(index + mark.Length, txt.Length - mark.Length); UIString.Instance.ParserString_RuntimeNoHL(TargetText, out parseRes); } else { cmpWin.AddText(txt); } } int demandNum = CUIDataPool.Instance.m_vecQuestDemandItem.Count; //if(demandNum > 0) //cmpWin.AddText("需要物品:"); for (int i = 0; i < demandNum; i++) { // SMissionBonus pBonus = new SMissionBonus(); // pBonus.m_ItemBonus.m_uItemID = CUIDataPool.Instance.m_pMissionDemandInfo.m_aDemandItem[i].m_uItemID; // pBonus.m_ItemBonus.m_yCount = CUIDataPool.Instance.m_pMissionDemandInfo.m_aDemandItem[i].m_yCount; QuestDemandItem demandItem = CUIDataPool.Instance.m_vecQuestDemandItem[i]; CommonAddDemand(demandItem); } cmpWin.ReLayout(); acceptBtn.gameObject.SetActiveRecursively(false); continueBtn.gameObject.SetActiveRecursively(missIsDone); continueBtn.Text = parseRes + " (继续)"; //refuseBtn.Text = "取消"; }