//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, November 06, 2017
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using System.Text;
|
using System.Text.RegularExpressions;
|
using System.Collections.Generic;
|
using System;
|
//用于任务分配
|
namespace vnxbqy.UI
|
{
|
|
|
public class TaskAllocation : Singleton<TaskAllocation>
|
|
{
|
|
private static StringBuilder textBuilder = new StringBuilder();
|
private const string Info_Pattern = "{([a-zA-Z0-9_]+)}";
|
TaskModel m_TaskModel;
|
TaskModel taskmodel {
|
get {
|
return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>());
|
}
|
}
|
public string GetTaskInfo(string val, int _item)//用于0820中字典的值替换(1字符串2任务ID)
|
{
|
textBuilder.Length = 0;
|
int index = 0;
|
if (Regex.IsMatch(val, Info_Pattern))
|
{
|
if (taskmodel.ReplaceDic.ContainsKey(_item))
|
{
|
Dictionary<string, int> _dic = taskmodel.ReplaceDic[_item];
|
foreach (Match match in Regex.Matches(val, Info_Pattern))
|
{
|
textBuilder.Append(val.Substring(index, match.Index - index));
|
if (_dic.ContainsKey(match.Groups[1].Value))
|
{
|
textBuilder.Append(_dic[match.Groups[1].Value]);
|
}
|
else
|
{
|
textBuilder.Append(0);
|
}
|
|
index = match.Index + match.Length;
|
}
|
}
|
textBuilder.Append(val.Substring(index, val.Length - index));
|
return textBuilder.ToString();
|
}
|
else
|
{
|
return val;
|
}
|
}
|
|
public int ForRingNumber()//获取赏金环数
|
{
|
if (taskmodel.ReplaceDic.ContainsKey(1))
|
{
|
Dictionary<string, int> _dic = taskmodel.ReplaceDic[1];
|
if (_dic.ContainsKey("around_count"))
|
{
|
string str = "around_count";
|
return _dic[str];
|
|
}
|
}
|
return 0;
|
}
|
public int ForRingAllNumber()//获取赏金总环数
|
{
|
if (taskmodel.ReplaceDic.ContainsKey(1))
|
{
|
Dictionary<string, int> _dic = taskmodel.ReplaceDic[1];
|
if (_dic.ContainsKey("around_allcount"))
|
{
|
string str = "around_allcount";
|
return _dic[str];
|
|
}
|
}
|
return 0;
|
}
|
|
public int FairyAuNumber()//获取仙盟环数
|
{
|
if (taskmodel.ReplaceDic.ContainsKey(1))
|
{
|
Dictionary<string, int> _dic = taskmodel.ReplaceDic[1];
|
if (_dic.ContainsKey("around_count_family"))
|
{
|
string str = "around_count_family";
|
return _dic[str];
|
|
}
|
}
|
return 0;
|
}
|
|
public int FairyAuAllNumber()//获取仙盟总环数
|
{
|
if (taskmodel.ReplaceDic.ContainsKey(1))
|
{
|
Dictionary<string, int> _dic = taskmodel.ReplaceDic[1];
|
if (_dic.ContainsKey("around_allcount_family"))
|
{
|
string str = "around_allcount_family";
|
return _dic[str];
|
|
}
|
}
|
return 0;
|
}
|
PlayerMainDate m_MainModel;
|
PlayerMainDate mainModel { get { return m_MainModel ?? (m_MainModel = ModelCenter.Instance.GetModel<PlayerMainDate>()); } }
|
public void SkillTask(int TaskID)//用于解锁被动技能任务
|
{
|
int Gold = (int)UIHelper.GetMoneyCnt(1);//仙玉
|
if (mainModel.TaskId_Skill.Contains(TaskID))
|
{
|
int Index = mainModel.TaskId_Skill.IndexOf(TaskID);
|
int NeedMoney = mainModel.NeedFairyJade[Index];
|
string strNull = string.Format(Language.Get("PassiveSkillTask3"), NeedMoney);
|
ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), strNull, (bool isOk) =>
|
{
|
if (isOk)
|
{
|
if (Gold >= NeedMoney)
|
{
|
taskmodel.CompletionOfTask(TaskID);
|
if (WindowCenter.Instance.IsOpen<SkillWin>())
|
{
|
return;
|
}
|
WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.SkillFunc2Type2);
|
}
|
else
|
{
|
if (VersionConfig.Get().isBanShu)
|
{
|
SysNotifyMgr.Instance.ShowTip("GoldErr");
|
return;
|
}
|
WindowCenter.Instance.Open<RechargeTipWin>();
|
}
|
}
|
});
|
}
|
}
|
|
DateTime m_TaskTime = DateTime.Now;
|
public DateTime TaskTime {
|
get { return m_TaskTime; }
|
set { m_TaskTime = value; }
|
}
|
|
}
|
|
}
|
|
|
|