unity客户端界面状态维护管理

--界面管理者
--[[
    思路  B界面需要监听C界面的变化   当从C界面回到B界面时需要刷新B界面的变化
          B界面需要监听D界面的变化   当从D界面回到B界面时需要刷新B界面的变化
    1.使用方法在返回到上一个界面时调用
        local Interfaces= GameData.GetInterfaces()
        EventManager.TriggerListener(EventType.InterfaceJump,{
            from = Interfaces[#Interfaces],
            to = Interfaces[#Interfaces-1] or "PnlMain(Clone)",
            data = {}
        })  
    2.使用方法  在打开一个界面B时
        local Interfaces= GameData.GetInterfaces()
        EventManager.TriggerListener(EventType.InterfaceJump,{
            from = Interfaces[#Interfaces] or "PnlMain(Clone)",
            to = "B(Clone)",
            data = {}
        })  

]]
function GameData.AddInterfaceJump(interfaceName)
    Interfaces[#Interfaces+1] = interfaceName
    -- EventManager.TriggerListener(EventType.InterfaceJump,{
    --     from = Interfaces[#Interfaces-1]or "PnlMain(Clone)" ,
    --     to = interfaceName,data = {}
    -- })
    print_table(Interfaces)
end 
function GameData.GetInterfaces()
    return Interfaces
end
function GameData.ClearInterfaces()
    Interfaces = {}
end
function GameData.RemoveLastInterfaces()
    -- EventManager.TriggerListener(EventType.InterfaceJump,{
    --     from = Interfaces[#Interfaces],
    --     to = Interfaces[#Interfaces-1]or "PnlMain(Clone)",
    --     data = {}
    -- })
    Interfaces[#Interfaces] = nil
    print_table(Interfaces)
end
--界面管理者

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值