Beispiel #1
0
    public void OnInit()
    {
        m_WorldModel = ProxyManager.GetInstance().Get <WorldProxy>();

        Game.StartCoroutine(GameAssets.LoadAssetAsync <GameObject>("load_preload$s_building$worldcity.assetbundle",
                                                                   "WorldCity",
                                                                   (prefab) =>
        {
            m_CityPrefab = prefab;
        }));
        Game.StartCoroutine(GameAssets.LoadAssetAsync <GameObject>("load_preload$s_character$worldmarch.assetbundle",
                                                                   "WorldMarch",
                                                                   (prefab) =>
        {
            m_MarchPrefab = prefab;
        }));
        Game.StartCoroutine(GameAssets.LoadAssetAsync <GameObject>("load_preload$s_character$selecttag.assetbundle",
                                                                   "SelectTag",
                                                                   (prefab) =>
        {
            m_SelectTagPrefab = prefab;
            m_selectTagObject = UnityEngine.Object.Instantiate(prefab);
            Utils.StandardizeObject(m_selectTagObject, m_World3DContainer.transform);
            m_selectTagObject.transform.localEulerAngles = new Vector3(90, 0, 0);
            m_selectTagObject.SetActive(false);
        }));

        m_World3DContainer = new GameObject("World3DContainer");
    }
    /// <summary>
    /// Create a UI
    /// </summary>
    /// <param name="p_type">UI category: fullscreen, window, popup, etc</param>
    /// <param name="p_name">name you defined</param>
    /// <param name="p_mediatorType"></param>
    /// <param name="p_bundlePath">prefab to instantiate</param>
    /// <param name="p_viewInitCallBack"></param>
    /// <param name="p_viewRefreshCallBack"></param>
    /// <param name="p_allocateDepth">allocate several panel depth to ui</param>
    /// <param name="p_viewName"></param>
    /// <param name="isShowAnimation"></param>
    private void CreateUI(UIItemConfig p_config, DelegateHelper.TableDelegate p_viewInitCallBack, DelegateHelper.TableDelegate p_viewRefreshCallBack = null, bool isShowAnimation = true)
    {
        try
        {
            if (!m_UICategoryMap.ContainsKey(p_config.Type))
            {
                throw new KeyNotFoundException(string.Format("Key: {0} not found in UI Category.", p_config.Type));
            }

            if (p_config.BundleName == null)
            {
                throw new Exception("Cannot create UI cause no res provided.");
            }

            Game.StartCoroutine(GameAssets.LoadAssetAsync <GameObject>(p_config.BundleName, p_config.AssetName,
                                                                       (prefab) =>
            {
                CreateUIInternal(p_config, prefab, p_viewInitCallBack,
                                 p_viewRefreshCallBack, isShowAnimation);
            }));
            GameAssets.AddBundleRef(p_config.BundleName);
        }
        catch (Exception e)
        {
            LogModule.ErrorLog("Exception in create UI, {0}\n{1}", e.Message, e.StackTrace);
            return;
        }
    }
    public void OnInit()
    {
        if (View == null)
        {
            Game.StartCoroutine(GameAssets.LoadAssetAsync <GameObject>(BattleUIView.BundleName, BattleUIView.AssetName,
                                                                       (prefab) =>
            {
                var ins = Object.Instantiate(prefab);
                Utils.StandardizeObject(ins);

                if (View == null)
                {
                    View = ins.GetComponent <BattleUIView>();
                }

                AddListener();

                var troopList = GameFacade.GetProxy <BattleProxy>().BattleInfor.objList.Where(item => item.skilldataid != null && item.skilldataid.Any()).Select(item => item.id).ToList();
                for (int i = 0; i < troopList.Count; i++)
                {
                    SkillIndexToTroopIndex.Add(i, troopList[i]);
                }

                IsInited = true;
            }));
            GameAssets.AddBundleRef(BattleUIView.BundleName);
        }
        else
        {
            IsInited = true;
        }
    }
Beispiel #4
0
    void Awake()
    {
        if (SelectTag == null)
        {
            Game.StartCoroutine(GameAssets.LoadAssetAsync <GameObject>("load_preload$s_character$selecttag.assetbundle", "SelectTag",
                                                                       (prefab) =>
            {
                SelectTag = Instantiate(prefab);
                Utils.StandardizeObject(SelectTag, transform);

                UnSelect();
            }));
        }
    }
 private IEnumerator InitUIFramework()
 {
     yield return(GameAssets.LoadAssetAsync <GameObject>("load_preload$s_ui$ui_root.assetbundle", "UI_Root", InitUIFrameworkInternal));
 }
Beispiel #6
0
 public static void LoadBundleGB(string assetBundleName, string assetName, LuaTable instance, Action <GameObject> OnLoadDone)
 {
     Game.StartCoroutine(GameAssets.LoadAssetAsync <GameObject>(assetBundleName, assetName, OnLoadDone));
 }