using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using System;
///
/// 关联界面索引表,用于获取途径,富文本打开界面等情况
///
public class UIJumpManager : GameSystemManager
{
public override void Init()
{
}
public bool CanOpenWin(int winID, bool showTip = false)
{
var config = WindowSearchConfig.Get(winID);
if (config == null)
{
return false;
}
if (config.FuncID !=0 && !FuncOpen.Instance.IsFuncOpen(config.FuncID, showTip))
{
return false;
}
//活动后续补充
return true;
}
public void OpenWindow(int winID, bool showTip = true)
{
if (!CanOpenWin(winID, showTip))
{
return;
}
var config = WindowSearchConfig.Get(winID);
if (config.WinName == "StoreBaseWin")
{
//指定商品
StoreModel.Instance.jumpShopID = int.Parse(config.Extra);
if (StoreModel.Instance.jumpShopID == 0)
{
StoreModel.Instance.selectStoreFuncType = StoreFunc.Normal;
}
else
{
StoreModel.Instance.selectStoreFuncType = (StoreFunc)StoreConfig.Get(StoreModel.Instance.jumpShopID).ShopType;
}
}
if (!UIManager.Instance.IsOpened(config.WinName))
{
UIManager.Instance.OpenWindow(config.WinName, config.TabIndex);
}
else
{
var ui = UIManager.Instance.GetUI(config.WinName) as OneLevelWin;
ui?.ClickFuncBtn(config.TabIndex);
}
}
}