Esempio n. 1
0
        //---------------------------------------------------------------------
        public void LoadIconAsync(string id, string resource_path, string resource_name, GameObject head_icon, Action <Texture> load_callback = null)
        {
            if (MapHeadIconResources.TryGetValue(id, out Texture head_resource))
            {
                if (head_icon != null)
                {
                    head_icon.SetActive(true);
                }

                if (load_callback != null)
                {
                    load_callback(head_resource);
                }
            }
            else
            {
                if (MbAsyncLoadAssets == null)
                {
                    var go = GameObject.Find("Launch");
                    MbAsyncLoadAssets = go.GetComponent <MbAsyncLoadAssets>();
                }

                MbAsyncLoadAssets.WWWLoadTextureAsync(resource_path, load_callback);
            }
        }
Esempio n. 2
0
        //---------------------------------------------------------------------
        public LoaderTicket asyncLoadIcon(string id, string resource_path,
                                          string resource_name, GameObject head_icon,
                                          Action <UnityEngine.Object, LoaderTicket> load_callback = null)
        {
            LoaderTicket loader_ticket = null;
            Texture      head_resource = null;

            if (MapHeadIconResources.TryGetValue(id, out head_resource))
            {
                if (head_icon != null)
                {
                    head_icon.SetActive(true);
                    //UiHelper.setActiveState(true, head_icon);
                    //UiHelper.setTexture(head_icon, head_resource);
                }

                if (load_callback != null)
                {
                    load_callback(head_resource, loader_ticket);
                }
            }
            else
            {
                if (MapLoadingIcon.ContainsKey(id))
                {
                    return(loader_ticket);
                }

                MapLoadingIcon[id] = id;
                loader_ticket      = CasinosContext.Instance.AsyncAssetLoadGroup.asyncLoadAsset(
                    resource_path, resource_name, _eAsyncAssetLoadType.WWWRawAsset,
                    (LoaderTicket ticket, string path, UnityEngine.Object obj) =>
                {
                    MapLoadingIcon.Remove(id);
                    if (obj != null)
                    {
                        MapHeadIconResources[id] = (Texture)obj;
                        if (head_icon != null)
                        {
                            head_icon.SetActive(true);
                            //UiHelper.setActiveState(true, head_icon);
                            //UiHelper.setTexture(head_icon, (Texture)obj);
                        }
                    }

                    if (load_callback != null)
                    {
                        load_callback(obj, loader_ticket);
                    }
                });
            }

            return(loader_ticket);
        }
Esempio n. 3
0
        //-------------------------------------------------------------------------
        //public static string getIconURL(bool is_small, string icon_name)
        //{
        //    CasinosContext.Instance.ClearSB();

        //    var sb = CasinosContext.Instance.SB;
        //    sb.Append(CasinosContext.Instance.UserConfig.Current.BotIconDomain);
        //    if (is_small) sb.Append(mBotIconSmall);
        //    else sb.Append(mBotIcon);
        //    sb.Append(icon_name);
        //    sb.Append(".jpg");

        //    return sb.ToString();
        //}

        //-------------------------------------------------------------------------
        public void destroyCurrentResources()
        {
            foreach (var i in MapHeadIconResources)
            {
                if (i.Value != null)
                {
                    GameObject.DestroyImmediate(i.Value, true);
                }
            }

            MapHeadIconResources.Clear();
        }