//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, September 18, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
|
public class SkillTaskWin : Window
|
{
|
[SerializeField] RichText m_Text_Condition_1;//条件
|
[SerializeField] RichText m_Text_Reward_1;//奖励
|
[SerializeField] Text m_NeedMoney_Text;//所需仙玉
|
[SerializeField] Button m_GoToSkillBtn;
|
[SerializeField] Button m_OpenNowBtn;
|
[SerializeField] Button m_GoToBtn;
|
[SerializeField] Button m_ClaoseBtn;
|
[SerializeField] Image m_Image;//孔数
|
PlayerMainDate m_MainModel;
|
PlayerMainDate mainModel { get { return m_MainModel ?? (m_MainModel = ModelCenter.Instance.GetModel<PlayerMainDate>()); } }
|
TaskModel m_TaskModel;
|
TaskModel taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>()); } }
|
#region Built-in
|
protected override void BindController()
|
{
|
|
}
|
|
protected override void AddListeners()
|
{
|
m_ClaoseBtn.AddListener(() => { Close(); });
|
m_GoToSkillBtn.AddListener(OnClickGoToSkillBtn);
|
m_OpenNowBtn.AddListener(OnClickOpenNowBtn);
|
m_GoToBtn.AddListener(OnClickGoToBtn);
|
}
|
|
protected override void OnPreOpen()
|
{
|
if (!taskmodel.allMissionDict.ContainsKey(mainModel.TaskSkillID))
|
{
|
return;
|
}
|
string str = taskmodel.allMissionDict[mainModel.TaskSkillID].InforList;
|
var taskinfo = TASKINFOConfig.Get(str);
|
if (taskinfo != null)
|
{
|
m_Text_Condition_1.text = taskinfo.show_writing;
|
if (taskmodel._DicTaskInformation.ContainsKey(mainModel.TaskSkillID))
|
{
|
Dictionary<string, string> SkillDic = new Dictionary<string, string>();
|
SkillDic = taskmodel._DicTaskInformation[mainModel.TaskSkillID];
|
string strA = "on_kill_" + mainModel.TaskSkillID.ToString();
|
string strB = "get_byid_" + mainModel.TaskSkillID.ToString();
|
m_Text_Condition_1.SetReplaceInfo(SkillDic);
|
}
|
}
|
if (mainModel.TaskId_Skill.Contains(mainModel.TaskSkillID))
|
{
|
int Index = mainModel.TaskId_Skill.IndexOf(mainModel.TaskSkillID);
|
m_Text_Reward_1.text = string.Format(Language.Get("PassiveSkillTask1"), (mainModel.SkillIndex[Index] + 1));
|
SetImageSprite(mainModel.SkillIndex[Index] + 1);
|
m_NeedMoney_Text.text = string.Format(Language.Get("PassiveSkillTask2"), mainModel.NeedFairyJade[Index]);
|
}
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
|
}
|
|
private void OnClickGoToSkillBtn()
|
{
|
if (mainModel.TaskId_Skill.Contains(mainModel.TaskSkillID))
|
{
|
int Index = mainModel.TaskId_Skill.IndexOf(mainModel.TaskSkillID);
|
mainModel.Skill_Index = mainModel.SkillIndex[Index] + 1;
|
}
|
WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.SkillFunc2);
|
}
|
private void OnClickOpenNowBtn()
|
{
|
int Gold = (int)UIHelper.GetMoneyCnt(1);//仙玉
|
if (mainModel.TaskId_Skill.Contains(mainModel.TaskSkillID))
|
{
|
int Index = mainModel.TaskId_Skill.IndexOf(mainModel.TaskSkillID);
|
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(mainModel.TaskSkillID);
|
WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.SkillFunc2Type2);
|
}
|
else
|
{
|
if (VersionConfig.Get().isBanShu)
|
{
|
SysNotifyMgr.Instance.ShowTip("GoldErr");
|
return;
|
}
|
WindowCenter.Instance.Open<RechargeTipWin>();
|
}
|
}
|
});
|
}
|
}
|
private void OnClickGoToBtn()
|
{
|
|
m_Text_Condition_1.ExcuteHref();
|
|
// Close();
|
}
|
|
private void SetImageSprite(int Index)
|
{
|
switch (Index)
|
{
|
case 1:
|
m_Image.SetSprite("Slot_1");
|
break;
|
case 2:
|
m_Image.SetSprite("Slot_2");
|
break;
|
case 3:
|
m_Image.SetSprite("Slot_3");
|
break;
|
case 4:
|
m_Image.SetSprite("Slot_4");
|
break;
|
case 5:
|
m_Image.SetSprite("Slot_5");
|
break;
|
case 6:
|
m_Image.SetSprite("Slot_6");
|
break;
|
|
}
|
}
|
#endregion
|
|
}
|
|
}
|