コード例 #1
0
    void InitWindow(CUILoadState uiState, CUIController uiBase, bool open, params object[] args)
    {
        uiBase.OnInit();
        if (OnInitEvent != null)
        {
            OnInitEvent(uiBase);
        }
        if (open)
        {
            OnOpen(uiState, args);
            uiBase.gameObject.SetActive(true);
        }
        else
        {
            if (!uiState.IsStaticUI)
            {
                CloseWindow(uiBase.UIName); // Destroy
            }
            else
            {
                uiBase.gameObject.SetActive(false);
            }
        }

        OnUIWindowLoadedCallbacks(uiState, uiBase);
    }
コード例 #2
0
ファイル: CUIManager.cs プロジェクト: WaylandGod/CosmosEngine
    IEnumerator LoadUIAssetBundle(string path, string name, CUILoadState openState)
    {
        CAssetLoader assetLoader = new CAssetLoader(path);

        while (!assetLoader.IsFinished)
        {
            yield return(null);
        }

        GameObject uiObj = (GameObject)assetLoader.Asset;

        openState.IsLoading = false;

        uiObj.SetActive(false);
        uiObj.name = openState.Name;

        UiBridge.UIObjectFilter(uiObj);

        CUIController uiBase = (CUIController)uiObj.AddComponent(openState.UIType);

        openState.UIWindow = uiBase;

        uiBase.UIName = uiBase.UITemplateName = openState.Name;
        InitWindow(openState, uiBase, openState.OpenWhenFinish, openState.OpenArgs);
        OnUIWindowLoaded(openState, uiBase);
    }
コード例 #3
0
ファイル: CUIManager.cs プロジェクト: WaylandGod/CosmosEngine
    void OnDynamicWindowCallback(CUIController _ui, object[] _args)
    {
        string template = (string)_args[0];
        string name     = (string)_args[1];

        GameObject uiObj = (GameObject)UnityEngine.Object.Instantiate(_ui.gameObject);

        uiObj.name = name;

        UiBridge.UIObjectFilter(uiObj);

        CUIController uiBase = uiObj.GetComponent <CUIController>();

        uiBase.UITemplateName = template;
        uiBase.UIName         = name;

        CUILoadState _instanceUIState = UIWindows[name];

        _instanceUIState.IsLoading = false;
        _instanceUIState.UIWindow  = uiBase;

        object[] originArgs = new object[_args.Length - 2];  // 去除前2个参数
        for (int i = 2; i < _args.Length; i++)
        {
            originArgs[i - 2] = _args[i];
        }

        InitWindow(_instanceUIState, uiBase, true, originArgs);
        OnUIWindowLoaded(_instanceUIState, uiBase);
    }
コード例 #4
0
    void OnOpen(CUILoadState uiState, params object[] args)
    {
        if (uiState.IsLoading)
        {
            uiState.OpenWhenFinish = true;
            uiState.OpenArgs       = args;
            return;
        }

        CUIController uiBase = uiState.UIWindow;

        Action doOpenAction = () =>
        {
            if (uiBase.gameObject.activeSelf)
            {
                uiBase.OnClose();
            }

            uiBase.gameObject.SetActive(true);

            uiBase.OnOpen(args);

            if (OnOpenEvent != null)
            {
                OnOpenEvent(uiBase);
            }
        };

        doOpenAction();
    }
コード例 #5
0
    IEnumerator LoadUIAssetBundle(string path, string name, CUILoadState openState)
    {
        var assetLoader = CStaticAssetLoader.Load(path);

        openState.UIResourceLoader = assetLoader;  // 基本不用手工释放的
        while (!assetLoader.IsFinished)
        {
            yield return(null);
        }

        GameObject uiObj = (GameObject)assetLoader.TheAsset;

        openState.IsLoading = false;  // Load完

        uiObj.SetActive(false);
        uiObj.name = openState.TemplateName;

        CUIController uiBase = (CUIController)uiObj.AddComponent(openState.UIType);

        UiBridge.UIObjectFilter(uiBase, uiObj);

        openState.UIWindow = uiBase;

        uiBase.UIName = uiBase.UITemplateName = openState.TemplateName;
        InitWindow(openState, uiBase, openState.OpenWhenFinish, openState.OpenArgs);
    }
コード例 #6
0
ファイル: CUIManager.cs プロジェクト: WaylandGod/CosmosEngine
    void InitWindow(CUILoadState uiState, CUIController uiBase, bool open, params object[] args)
    {
        uiBase.OnInit();

        if (open)
        {
            OnOpen(uiState, args);
            uiBase.gameObject.SetActive(true);
        }
    }
コード例 #7
0
 public CXHome(CUIController controller) : base("Home", new SnipsNLUEngine(Path.Combine("Engines", "home")), controller)
 {
     MenuHandlers[Prefixed("PACKAGES")] = GetPackagesMenuItem;
     MenuIndexes[Prefixed("PACKAGES")]  = 3;
     Initialized = NLUEngine.Initialized;
     if (!Initialized)
     {
         SayErrorLine("NLU engine for package {0} did not initialize. Exiting.", this.Name);
         Program.Exit(ExitResult.UNKNOWN_ERROR);
     }
 }
コード例 #8
0
ファイル: CUIManager.cs プロジェクト: WaylandGod/CosmosEngine
 void OnUIWindowLoaded(CUILoadState uiState, CUIController uiBase)
 {
     //if (openState.OpenWhenFinish)  // 加载完打开 模式下,打开时执行回调
     {
         while (uiState.CallbacksWhenFinish.Count > 0)
         {
             Action <CUIController, object[]> callback = uiState.CallbacksWhenFinish.Dequeue();
             object[] _args = uiState.CallbacksArgsWhenFinish.Dequeue();
             callback(uiBase, _args);
         }
     }
 }
コード例 #9
0
ファイル: CUIManager.cs プロジェクト: WaylandGod/CosmosEngine
    public CUILoadState(string _UITypeName)
    {
        Name     = _UITypeName;
        UIWindow = null;
        UIType   = "CUI" + _UITypeName;

        IsLoading      = true;
        OpenWhenFinish = false;
        OpenArgs       = null;

        CallbacksWhenFinish     = new Queue <Action <CUIController, object[]> >();
        CallbacksArgsWhenFinish = new Queue <object[]>();
    }
コード例 #10
0
ファイル: CCity.cs プロジェクト: gryphus11/CityBuilding
 // Use this for initialization
 void Start()
 {
     _uiController     = GetComponent <CUIController>();
     Cash              = 1000;
     Food              = 0.0f;
     JobsCeiling       = 0.0f;
     buildingCounts[0] = 0;
     buildingCounts[1] = 0;
     buildingCounts[2] = 0;
     buildingCounts[3] = 0;
     _uiController.UpdateCityData();
     _uiController.UpdateDayCount();
 }
コード例 #11
0
ファイル: CUIModule.cs プロジェクト: scris/_GS
    public CBaseResourceLoader UIResourceLoader; // 加载器,用于手动释放资源

    public CUILoadState(string uiTypeTemplateName, string uiInstanceName)
    {
        TemplateName = uiTypeTemplateName;
        InstanceName = uiInstanceName;
        UIWindow     = null;
        UIType       = "CUI" + uiTypeTemplateName;

        IsLoading      = true;
        OpenWhenFinish = false;
        OpenArgs       = null;

        CallbacksWhenFinish     = new Queue <Action <CUIController, object[]> >();
        CallbacksArgsWhenFinish = new Queue <object[]>();
    }
コード例 #12
0
ファイル: CUIManager.cs プロジェクト: WaylandGod/CosmosEngine
    void OnOpen(CUILoadState uiState, params object[] args)
    {
        if (OpenWindowEvent != null)
        {
            OpenWindowEvent(uiState.UIType);
        }

        CUIController uiBase = uiState.UIWindow;

        uiBase.OnPreOpen();
        if (uiBase.gameObject.activeSelf)
        {
            uiBase.OnClose();
        }
        else
        {
            uiBase.gameObject.SetActive(true);
        }

        uiBase.OnOpen(args);
    }
コード例 #13
0
ファイル: CUIManager.cs プロジェクト: WaylandGod/CosmosEngine
    public bool IsOpen(string name)
    {
        CUIController uiBase = GetUIBase(name);

        return(uiBase == null ? false : uiBase.gameObject.activeSelf);
    }
コード例 #14
0
ファイル: CUGUIBridge.cs プロジェクト: moto2002/CosmosEngine
 public void UIObjectFilter(CUIController ui, GameObject uiObject)
 {
 }
コード例 #15
0
 public void UIObjectFilter(CUIController ui, GameObject uiObject)
 {
 }
コード例 #16
0
ファイル: CUIController.cs プロジェクト: XiaoLi666/crazy-bird
 // Methods:
 void Awake()
 {
     if (!m_instance) {
         m_instance = this;
     }
 }