//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Wednesday, October 18, 2017
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
|
|
namespace vnxbqy.UI
|
{
|
|
public class TeamSubMissionBehaviour : MonoBehaviour
|
{
|
|
[SerializeField] Text m_Mission;
|
[SerializeField] FontColorSizeConfig m_FontColorSize;
|
[SerializeField] ToggleButton m_MissionButton;
|
public ToggleButton missionButton {
|
get { return m_MissionButton; }
|
set { m_MissionButton = value; }
|
}
|
|
[SerializeField] TeamMissionGroup m_Group;
|
public TeamMissionGroup group {
|
get { return m_Group; }
|
set {
|
m_Group = value;
|
}
|
}
|
|
public int mapId { get; private set; }
|
public int mapEx { get; private set; }
|
|
TeamModel model { get { return ModelCenter.Instance.GetModel<TeamModel>(); } }
|
DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
|
public void SetMission(int _mapId, int _lineId)
|
{
|
mapId = _mapId;
|
mapEx = _lineId;
|
|
if (_mapId == TeamModel.NONE_MISSION)
|
{
|
m_Mission.text = Language.Get("No_Target");
|
}
|
else if (_mapId == TeamModel.CURRENTMAP_MISSION)
|
{
|
m_Mission.text = Language.Get("RightHereMap");
|
}
|
else
|
{
|
var dungeonId = dungeonModel.GetDungeonId(_mapId, _lineId);
|
var config = DungeonConfig.Get(dungeonId);
|
m_Mission.text = config.FBName;
|
}
|
|
if (mapId == model.missionBuf.mapId && mapEx == model.missionBuf.mapEx)
|
{
|
SelectMission();
|
}
|
else
|
{
|
OnSelected(false);
|
}
|
missionButton.RemoveListener();
|
missionButton.AddListener(SelectMission);
|
missionButton.RemoveOnValueChange();
|
missionButton.OnValueChange(OnSelected);
|
}
|
|
public void SelectMission()
|
{
|
m_MissionButton.isOn = true;
|
if (group != null)
|
{
|
group.NotifySelectMission(mapId, mapEx);
|
}
|
}
|
|
private void OnSelected(bool _value)
|
{
|
m_Mission.color = m_FontColorSize.GetColorSize(_value ? "Selected" : "UnSelected").color;
|
}
|
|
}
|
|
}
|