新增 自定义UI 映射字典
This commit is contained in:
parent
b2449f638e
commit
865eab1ff4
@ -259,7 +259,7 @@ public class ActionHelper
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ICondition GetCondition(XMLTool.ActionItem condition)
|
public static ICondition GetCondition(XMLTool.ActionItem condition)
|
||||||
{
|
{
|
||||||
if (condition!=null)
|
if (condition != null)
|
||||||
{
|
{
|
||||||
switch (condition.Type)
|
switch (condition.Type)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -47,21 +47,39 @@ public class UIShowAction : IAction
|
|||||||
|
|
||||||
public void OnStart()
|
public void OnStart()
|
||||||
{
|
{
|
||||||
if (isShow)
|
Type type = null;
|
||||||
|
if (ActionHelper.typeDict.ContainsKey(uiName))
|
||||||
{
|
{
|
||||||
UIKit.OpenPanelAsync(ActionHelper.typeDict[uiName], assetBundleName: uiName).ToAction().StartGlobal(() => this.Finish());
|
type = ActionHelper.typeDict[uiName];
|
||||||
|
}
|
||||||
|
else if (CustomUIMap.typeDict.ContainsKey(uiName))
|
||||||
|
{
|
||||||
|
type = CustomUIMap.typeDict[uiName];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == null)
|
||||||
|
{
|
||||||
|
Debug.LogError($"{uiName} ÀàÐÍûÓÐÕÒµ½");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (UIKit.GetPanel(ActionHelper.typeDict[uiName]) != null)
|
if (isShow)
|
||||||
{
|
{
|
||||||
UIKit.HidePanel(ActionHelper.typeDict[uiName]);
|
UIKit.OpenPanelAsync(type, assetBundleName: uiName).ToAction().StartGlobal(() => this.Finish());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (UIKit.GetPanel(type) != null)
|
||||||
|
{
|
||||||
|
UIKit.HidePanel(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Finish();
|
this.Finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
Status = ActionStatus.NotStart;
|
Status = ActionStatus.NotStart;
|
||||||
|
|||||||
8
Assets/Scripts/Custom.meta
Normal file
8
Assets/Scripts/Custom.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4af85a692b427464ebde5004dd992d5e
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Scripts/Custom/UIMap.meta
Normal file
8
Assets/Scripts/Custom/UIMap.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bb813d5416f284549bb272f36e3423e5
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
18
Assets/Scripts/Custom/UIMap/CustomUIMap.cs
Normal file
18
Assets/Scripts/Custom/UIMap/CustomUIMap.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using QFramework.Example;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class CustomUIMap : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
// 注意:此处专门给支线用的 主线的UI类型映射填写到 ActionHelper.cs的typeDict中
|
||||||
|
public static readonly Dictionary<string, Type> typeDict = new Dictionary<string, Type>()
|
||||||
|
{
|
||||||
|
//{ "UIOperationList", typeof(UIOperationList) },
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/Scripts/Custom/UIMap/CustomUIMap.cs.meta
Normal file
11
Assets/Scripts/Custom/UIMap/CustomUIMap.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 399446e5e27181e439731e9cbd025286
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
x
Reference in New Issue
Block a user