| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Wednesday, September 06, 2017 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using TableConfig; |
| | | using Snxxz.UI; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class LocalMapEventPointToggle : ScrollItem |
| | | { |
| | | [SerializeField] RectTransform m_LayoutLeft; |
| | | [SerializeField] RectTransform m_LayoutRight; |
| | | [SerializeField] ButtonEx m_Button; |
| | | [SerializeField] Image m_Icon; |
| | | [SerializeField] TextEx m_Title; |
| | | [SerializeField] Text m_Level; |
| | | [SerializeField] Transform m_Selected; |
| | | [SerializeField] Button m_FlyBoot; |
| | | [SerializeField] Image m_MonsterType; |
| | | [SerializeField] FontColorSizeConfig m_FontColor; |
| | | |
| | | int m_EventId; |
| | | |
| | | MapModel model { get { return ModelCenter.Instance.GetModel<MapModel>(); } } |
| | | PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } |
| | | |
| | | public override void Display(object _data) |
| | | { |
| | | base.Display(_data); |
| | | |
| | | m_EventId = (int)_data; |
| | | var mapConfig = ConfigManager.Instance.GetTemplate<MapConfig>(PlayerDatas.Instance.baseData.MapID); |
| | | m_LayoutLeft.gameObject.SetActive(mapConfig.MapFBType == (int)MapType.OpenCountry); |
| | | |
| | | DrawEventInfo(); |
| | | OnSelected(model.selectedLocalMapEventPoint); |
| | | model.selectLocalMapEventPointEvent += OnSelected; |
| | | } |
| | | |
| | | public override void Dispose() |
| | | { |
| | | base.Dispose(); |
| | | model.selectLocalMapEventPointEvent -= OnSelected; |
| | | } |
| | | |
| | | private void Awake() |
| | | { |
| | | this.m_Button.AddListener(SelectEventPoint); |
| | | this.m_FlyBoot.AddListener(FlyToEventPoint); |
| | | } |
| | | |
| | | private void DrawEventInfo() |
| | | { |
| | | var config = ConfigManager.Instance.GetTemplate<TableConfig.MapEventPointConfig>(this.m_EventId); |
| | | var tagChinNpcMod = ConfigManager.Instance.GetTemplate<NPCConfig>(config.NPCID); |
| | | this.m_Title.text = tagChinNpcMod != null ? tagChinNpcMod.charName : ""; |
| | | if (config.LowLV == config.HighestLV) |
| | | { |
| | | this.m_Level.text = Language.Get("Z1024", config.LowLV); |
| | | } |
| | | else |
| | | { |
| | | this.m_Level.text = StringUtility.Contact(Language.Get("Z1024", config.LowLV), "-", config.HighestLV); |
| | | } |
| | | |
| | | this.m_MonsterType.SetSprite(StringUtility.Contact("MapNPC_Colour_", config.Colour)); |
| | | } |
| | | |
| | | private void FlyToEventPoint() |
| | | { |
| | | var flyBootOwn = playerPack.GetItemCountByID(PackType.rptItem, GeneralConfig.Instance.flyBootItemId); |
| | | var isVipFreeTransfer = ModelCenter.Instance.GetModel<VipModel>().GetVipPrivilegeCnt(VipPrivilegeType.FreeTransfer) > 0; |
| | | if (isVipFreeTransfer || flyBootOwn > 0) |
| | | { |
| | | MoveToNpc(); |
| | | } |
| | | else |
| | | { |
| | | FlyShoseConfirmwin.useEnvironment = FlyShoseConfirmwin.UseEnvironment.LocalMap; |
| | | FlyShoseConfirmwin.confirmCallBack = MoveToNpc; |
| | | WindowCenter.Instance.Open<FlyShoseConfirmwin>(); |
| | | } |
| | | } |
| | | |
| | | private void MoveToNpc() |
| | | { |
| | | var mapNPCConfig = ConfigManager.Instance.GetTemplate<MapEventPointConfig>(m_EventId); |
| | | MapTransferUtility.Instance.MissionFlyTo(PlayerDatas.Instance.baseData.MapID, mapNPCConfig.NPCID); |
| | | |
| | | WindowCenter.Instance.Close<WorldMapWin>(); |
| | | WindowCenter.Instance.Close<LocalMapWin>(); |
| | | WindowCenter.Instance.Open<MainInterfaceWin>(); |
| | | } |
| | | |
| | | private void SelectEventPoint() |
| | | { |
| | | model.selectedLocalMapEventPoint = m_EventId; |
| | | } |
| | | |
| | | private void OnSelected(int _event) |
| | | { |
| | | var selected = _event == m_EventId; |
| | | m_Selected.gameObject.SetActive(selected); |
| | | this.m_Title.color = this.m_Level.color = m_FontColor.GetColorSize(selected ? "Selected" : "Normal").color; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Wednesday, September 06, 2017
|
| | | //--------------------------------------------------------
|
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using UnityEngine.UI;
|
| | | using TableConfig;
|
| | | using Snxxz.UI;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | |
|
| | | public class LocalMapEventPointToggle : ScrollItem
|
| | | {
|
| | | [SerializeField] RectTransform m_LayoutLeft;
|
| | | [SerializeField] RectTransform m_LayoutRight;
|
| | | [SerializeField] ButtonEx m_Button;
|
| | | [SerializeField] Image m_Icon;
|
| | | [SerializeField] TextEx m_Title;
|
| | | [SerializeField] Text m_Level;
|
| | | [SerializeField] Transform m_Selected;
|
| | | [SerializeField] Button m_FlyBoot;
|
| | | [SerializeField] Image m_MonsterType;
|
| | | [SerializeField] FontColorSizeConfig m_FontColor;
|
| | |
|
| | | int m_EventId;
|
| | |
|
| | | MapModel model { get { return ModelCenter.Instance.GetModel<MapModel>(); } }
|
| | | PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
|
| | |
|
| | | public override void Display(object _data)
|
| | | {
|
| | | base.Display(_data);
|
| | |
|
| | | m_EventId = (int)_data;
|
| | | var mapConfig = Config.Instance.Get<MapConfig>(PlayerDatas.Instance.baseData.MapID);
|
| | | m_LayoutLeft.gameObject.SetActive(mapConfig.MapFBType == (int)MapType.OpenCountry);
|
| | |
|
| | | DrawEventInfo();
|
| | | OnSelected(model.selectedMapEventPoint);
|
| | | model.selectMapEventPointEvent += OnSelected;
|
| | | }
|
| | |
|
| | | public override void Dispose()
|
| | | {
|
| | | base.Dispose();
|
| | | model.selectMapEventPointEvent -= OnSelected;
|
| | | }
|
| | |
|
| | | private void Awake()
|
| | | {
|
| | | this.m_Button.AddListener(SelectEventPoint);
|
| | | this.m_FlyBoot.AddListener(FlyToEventPoint);
|
| | | }
|
| | |
|
| | | private void DrawEventInfo()
|
| | | {
|
| | | var config = Config.Instance.Get<TableConfig.MapEventPointConfig>(this.m_EventId);
|
| | | var tagChinNpcMod = Config.Instance.Get<NPCConfig>(config.NPCID);
|
| | | this.m_Title.text = tagChinNpcMod != null ? tagChinNpcMod.charName : "";
|
| | | if (config.LowLV == config.HighestLV)
|
| | | {
|
| | | this.m_Level.text = Language.Get("Z1024", config.LowLV);
|
| | | }
|
| | | else
|
| | | {
|
| | | this.m_Level.text = StringUtility.Contact(Language.Get("Z1024", config.LowLV), "-", config.HighestLV);
|
| | | }
|
| | |
|
| | | this.m_MonsterType.SetSprite(StringUtility.Contact("MapNPC_Colour_", config.Colour));
|
| | | }
|
| | |
|
| | | private void FlyToEventPoint()
|
| | | {
|
| | | var flyBootOwn = playerPack.GetItemCountByID(PackType.rptItem, GeneralDefine.flyBootItemId);
|
| | | var isVipFreeTransfer = ModelCenter.Instance.GetModel<VipModel>().GetVipPrivilegeCnt(VipPrivilegeType.FreeTransfer) > 0;
|
| | | if (isVipFreeTransfer || flyBootOwn > 0)
|
| | | {
|
| | | MoveToNpc();
|
| | | }
|
| | | else
|
| | | {
|
| | | FlyShoseConfirmwin.useEnvironment = FlyShoseConfirmwin.UseEnvironment.LocalMap;
|
| | | FlyShoseConfirmwin.confirmCallBack = MoveToNpc;
|
| | | WindowCenter.Instance.Open<FlyShoseConfirmwin>();
|
| | | }
|
| | | }
|
| | |
|
| | | private void MoveToNpc()
|
| | | {
|
| | | var config = Config.Instance.Get<MapEventPointConfig>(m_EventId);
|
| | | MapTransferUtility.Instance.MissionFlyTo(PlayerDatas.Instance.baseData.MapID, config.NPCID);
|
| | |
|
| | | WindowCenter.Instance.Close<WorldMapWin>();
|
| | | WindowCenter.Instance.Close<LocalMapWin>();
|
| | | WindowCenter.Instance.Open<MainInterfaceWin>();
|
| | | }
|
| | |
|
| | | private void SelectEventPoint()
|
| | | {
|
| | | model.selectedMapEventPoint = m_EventId;
|
| | | }
|
| | |
|
| | | private void OnSelected(int _event)
|
| | | {
|
| | | var selected = _event == m_EventId;
|
| | | m_Selected.gameObject.SetActive(selected);
|
| | | this.m_Title.color = this.m_Level.color = m_FontColor.GetColorSize(selected ? "Selected" : "Normal").color;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|