Ejemplo n.º 1
0
 public KeywordResourceInfo(int resourceId, int publishmentSystemId, int keywordId, string title, string imageUrl, string summary, EResourceType resourceType, bool isShowCoverPic, string content, string navigationUrl, int channelId, int contentId, int taxis)
 {
     ResourceId          = resourceId;
     PublishmentSystemId = publishmentSystemId;
     KeywordId           = keywordId;
     Title          = title;
     ImageUrl       = imageUrl;
     Summary        = summary;
     ResourceType   = resourceType;
     IsShowCoverPic = isShowCoverPic;
     Content        = content;
     NavigationUrl  = navigationUrl;
     ChannelId      = channelId;
     ContentId      = contentId;
     Taxis          = taxis;
 }
Ejemplo n.º 2
0
 public KeywordResourceInfo()
 {
     resourceID          = 0;
     publishmentSystemID = 0;
     keywordID           = 0;
     title          = string.Empty;
     imageUrl       = string.Empty;
     summary        = string.Empty;
     resourceType   = EResourceType.Content;
     isShowCoverPic = true;
     content        = string.Empty;
     navigationUrl  = string.Empty;
     channelID      = 0;
     contentID      = 0;
     taxis          = 0;
 }
Ejemplo n.º 3
0
        public WebResource(EResourceType t)
        {
            Cache = true;
            type = t;

            switch (type)
            {
                case EResourceType.CSS:
                    ctrl = new HtmlCustomControl("link");
                    break;
                case EResourceType.Javascript:
                    ctrl = new HtmlCustomControl("script");
                    break;
                case EResourceType.Favicon:
                    ctrl = new HtmlCustomControl("link");
                    break;
            }
        }
Ejemplo n.º 4
0
 public static string GetValue(EResourceType type)
 {
     if (type == EResourceType.Site)
     {
         return("Site");
     }
     else if (type == EResourceType.Url)
     {
         return("Url");
     }
     else if (type == EResourceType.Content)
     {
         return("Content");
     }
     else
     {
         throw new Exception();
     }
 }
Ejemplo n.º 5
0
    public void LoadResourcesAsync <T>(EResourceType resType, string name, DLoadResourcesCompete action)
        where T : Object
    {
        string path = GameResFunc.GetResPath(resType, name);

        if (string.IsNullOrEmpty(path))
        {
            Log(ELogType.Error, string.Format("res path is null !!!!!      resType : {0}", resType));
            return;
        }

        ResLoadAsyncData data = GetAsyncData(path, action);

        m_resPathList.Add(data);
        if (m_asyncEnd)
        {
            StartCoroutine(LoadResAsync <T>());
        }
    }
Ejemplo n.º 6
0
 public static string GetText(EResourceType type)
 {
     if (type == EResourceType.Site)
     {
         return("΢ÍøÕ¾Ò³Ãæ");
     }
     else if (type == EResourceType.Content)
     {
         return("ÕýÎÄ");
     }
     else if (type == EResourceType.Url)
     {
         return("Ö¸¶¨ÍøÖ·");
     }
     else
     {
         throw new Exception();
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// リソース設定に記述されたファイルパスを取得する
        /// </summary>
        /// <param name="resourceName"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public string GetResourcePath(string resourceName, EResourceType type)
        {
            if (_resourceSetting == null || string.IsNullOrEmpty(resourceName))
            {
                return(null);
            }

            switch (type)
            {
            case EResourceType.Character:
                return(_resourceSetting.character.FirstOrDefault(_ => _.Name == resourceName)?.FilePath);

            case EResourceType.Bgm:
                return(_resourceSetting.bgm.FirstOrDefault(_ => _.Name == resourceName)?.FilePath);

            default:
                return(null);
            }
        }
Ejemplo n.º 8
0
 public static string GetText(EResourceType type)
 {
     if (type == EResourceType.Site)
     {
         return("微网站页面");
     }
     else if (type == EResourceType.Content)
     {
         return("正文");
     }
     else if (type == EResourceType.Url)
     {
         return("指定网址");
     }
     else
     {
         throw new Exception();
     }
 }
Ejemplo n.º 9
0
        public void GetGameObjAsync(string name, string path, EResourceType type, _DelegateGameObj onLoadOk)
        {
            //string path = ResourcePath.GetPath (type) + name + _bundleEx;

            AssetsResource ar;

            if (_originObjDic.TryGetValue(path, out ar))
            {
                if (!ar.LoadOk)
                {
                    ar.AddToWaitList(onLoadOk);
                    return;
                }
                onLoadOk(PoolMgr.Instance.GetGameObj(ar));
            }
            else
            {
                DownLoadResource(name, path, onLoadOk, type);
            }
        }
Ejemplo n.º 10
0
        private string GetNavHtml(EResourceType resourceType)
        {
            var nav = string.Empty;

            var list = new List <EResourceType>();

            list.Add(EResourceType.Site);
            list.Add(EResourceType.Content);
            list.Add(EResourceType.Url);

            foreach (var rType in list)
            {
                nav +=
                    $@"<li class=""{(rType == resourceType ? "active" : string.Empty)}""><a href=""javascript:;"" class=""{EResourceTypeUtils
                        .GetValue(rType)}"" resourceType=""{EResourceTypeUtils.GetValue(rType)}"">显示{EResourceTypeUtils
                        .GetText(rType)}</a></li>";
            }

            return(nav);
        }
Ejemplo n.º 11
0
        public void AddResourceType(EResourceType item)
        {
            if (_resourceTypes.Any(x => x.Name == item))
            {
                throw new Exception("Collection already contains this resource type");
            }

            uint index = 0;

            if (_resourceTypes.Count > 0)
            {
                index = _resourceTypes.Last().Id + 1;
            }

            _resourceTypes.Add(new ResourceType
            {
                Id   = index,
                Name = item
            });
        }
Ejemplo n.º 12
0
        public Object GetCached(string url, EResourceType type)
        {
            if (string.IsNullOrEmpty(url))
            {
                return(null);
            }
            switch (type)
            {
            case EResourceType.Effect:
            {
                return(_effectCached.GetCached(url));
            }

            case EResourceType.CharacterModel:
            {
                return(_modelCached.GetCached(url));
            }
            }
            return(null);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Creates a ResourceIWindowItem, which consists of the resources color, it's name and it's amount
        /// </summary>
        /// <param name="resourceType">resource type</param>
        /// <param name="amount">resource amount</param>
        /// <param name="size">size of the item to create (width important)</param>
        /// <param name="spriteFont">text's spritefont</param>
        public ResourceIWindowItem(EResourceType resourceType, int amount, Vector2 size, SpriteFont spriteFont)
        {
            mSpriteFont = spriteFont;

            mTypeColor    = ResourceHelper.GetColor(resourceType);
            mResourceText = resourceType.ToString();

            Amount = amount;

            // set to Vector.Zero, since the window will manage this item's position
            Position = Vector2.Zero;

            var minItemWidth = mSpriteFont.MeasureString("Y").Y / 2 + mSpriteFont.MeasureString(Amount.ToString()).X +
                               mSpriteFont.MeasureString(mResourceText).X + 30;

            // set size to automatically fit the text height + width
            Size = size.X < minItemWidth ? new Vector2(minItemWidth, mSpriteFont.MeasureString(mResourceText).Y) : new Vector2(size.X, mSpriteFont.MeasureString(mResourceText).Y);

            ActiveInWindow = true;
        }
Ejemplo n.º 14
0
        public void GetOriginObjAsync(string name, string path, EResourceType type, _DelegateObject onLoadOk)
        {
            //string path = ResourcePath.GetPath (type) + name + _bundleEx;

            AssetsResource ar;

            if (_originObjDic.TryGetValue(path, out ar))
            {
                if (!ar.LoadOk)
                {
                    ar.AddToWaitList(onLoadOk);
                    return;
                }
                ar.AddRef();
                onLoadOk(ar.OriginObj);
            }
            else
            {
                DownLoadOriginResource(name, path, onLoadOk, type);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// リソースリストに追加する
        /// </summary>
        /// <param name="resourceName"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private void AddResource(string resourceName, EResourceType type)
        {
            if (string.IsNullOrEmpty(resourceName))
            {
                return;
            }

            // 設定シートに該当するファイル名があれば、シートからファイルパスを取得する
            var settingFilePath = _resourceSetting.GetResourcePath(resourceName, type);

            if (!string.IsNullOrEmpty(settingFilePath) && !_resourceList.ContainsKey(settingFilePath))
            {
                _resourceList.Add(settingFilePath, type);
                _settingPathList.Add(resourceName, new Tuple <string, EResourceType>(settingFilePath, type));
            }
            else if (!_resourceList.ContainsKey(resourceName))
            {
                // シートに無ければ、そのままファイル名として扱う
                _resourceList.Add(resourceName, type);
            }
        }
Ejemplo n.º 16
0
        private void SetResource(EResourceType type, int qty)
        {
            switch (type)
            {
            case EResourceType.Gold:
                _iGold = qty;
                break;

            case EResourceType.Food:
                _iFood = qty;
                break;

            case EResourceType.Wood:
                _iWood = qty;
                break;

            case EResourceType.Stone:
                _iStone = qty;
                break;

            case EResourceType.Bow:
                _iBow = qty;
                break;

            case EResourceType.Sword:
                _iSword = qty;
                break;

            case EResourceType.Spear:
                _iSpear = qty;
                break;

            case EResourceType.Population:
                _iPopulation = qty;
                break;

            default:
                return;
            }
        }
Ejemplo n.º 17
0
        public void Update(EResourceType _type)
        {
            switch (_type)
            {
            case EResourceType.ITINERARY:
            {
                _quota -= 10;
                break;
            }

            case EResourceType.MAP:
            {
                _quota -= 1;
                break;
            }

            case EResourceType.PLACE:
            {
                _quota -= 5;
                break;
            }
            }
        }
Ejemplo n.º 18
0
    public void IncreaseCurrency(EResourceType type, int production)
    {
        switch (type)
        {
        case EResourceType.Wood:
            _wood = Mathf.Clamp(_wood + production, 0, 99);
            break;

        case EResourceType.Rock:
            _rock = Mathf.Clamp(_rock + production, 0, 99);
            break;

        case EResourceType.Gold:
            _gold = Mathf.Clamp(_gold + production, 0, 99);
            break;

        default:
            Debug.LogError($"Unknown currency: {type}");
            break;
        }

        UIRefreshCurrencies();
    }
Ejemplo n.º 19
0
        /// <summary>
        /// リソース設定からファイルパスを取得する
        /// </summary>
        /// <param name="resourceName"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public string GetFilePathFromResourceSetting(string resourceName, EResourceType type)
        {
            var values = _settingPathList.Where(_ => _.Key.Equals(resourceName));

            return(values.FirstOrDefault(_ => _.Value.Item2.Equals(type)).Value?.Item1);
        }
Ejemplo n.º 20
0
 public Resource(EResourceType type, Vector2 position, Director director) : base(ref director)
 {
     Type             = type;
     AbsolutePosition = position;
     AbsoluteSize     = new Vector2(10, 10);
 }
Ejemplo n.º 21
0
 public IntPtr Alloc(EResourceType type)
 {
     if (Available.Count == 0)
     {
         return new IntPtr(Last++);
     }
     else return new IntPtr(Available.Dequeue());
 }
Ejemplo n.º 22
0
 public static extern IntPtr FindResource(IntPtr hModule, int id, EResourceType type);
Ejemplo n.º 23
0
 public void ResourcesCollected(EResourceType type, int amount)
 {
     _itemsCollected[(int)type] += amount;
 }
Ejemplo n.º 24
0
 public int GetAmountOfResources(EResourceType type)
 {
     return(_itemsCollected[(int)type]);
 }
Ejemplo n.º 25
0
 public void LoadSceneAsync(string name, string path, EResourceType type, _DelegateAssetsResource onLoadOk)
 {
     DownLoadScene(name, path, onLoadOk, type);
 }
Ejemplo n.º 26
0
    /// <summary>
    /// 添加一个模型的加载数据
    /// 在结束解析的时候,开始加载
    /// </summary>
    /// <param name="model"></param>
    /// <param name="structure"></param>
    /// <param name="motion"></param>
    /// <param name="direction"></param>
    /// <param name="resourceType"></param>
    /// <param name="resourceAssistType"></param>
    protected void Load(uint model, EModelStructure structure, CSMotion motion, CSDirection direction, EResourceType resourceType, EResourceAssistType resourceAssistType)
    {
        //加载的模型不存在
        if (model == 0)
        {
            //如果要加载身体模型不存在,那么要注意清理其他的组件
            if (structure == EModelStructure.Body)
            {
            }
            return;
        }

        long key = GetKey((int)model, (int)motion, (int)direction, (int)structure);
        ModelComponentLoadData data = null;

        if (!ModelComponentLoadedCacheDic.TryGetValue(key, out data))
        {
            data = new T();
            ModelComponentLoadedCacheDic[key] = data;
        }
        data.Model              = model;
        data.Key                = key;
        data.Structure          = structure;
        data.ResourceType       = resourceType;
        data.ResourceAssistType = resourceAssistType;

        WaitLoadComponentKey.Add(data);
    }
Ejemplo n.º 27
0
        private IEnumerator _LoadLevel(string path, LoadLevelFinishEventHandle handle, EResourceType resourceType, ResourceAsyncOperation operation)
        {
            if (UsedAssetBundle)
            {
                AssetInfo sceneAssetInfo = mAssetInfoManager.GetAssetInfo(path);
                // 获取该资源总大小(包括依赖资源)
                operation.mAllDependenciesAssetSize = mAssetInfoManager.GetAllAssetSize(sceneAssetInfo);

                // 加载依赖资源
                foreach (int index in sceneAssetInfo.mDependencies)
                {
                    AssetInfo dependencyAsset     = mAssetInfoManager.GetAssetInfo(index);
                    string    dependencyAssetName = dependencyAsset.Name;

                    ResourceUnit unit = _LoadImmediate(dependencyAssetName, EResourceType.LEVEL);
                    operation.mLoadedDependenciesAssetSize += unit.AssetBundleSize;
                }

                // 加载场景的AssetBundle
                int         sceneAssetBundleSize = 0;
                byte[]      binary      = FileUtil.GetAssetBundleFileBytes(path, ref sceneAssetBundleSize);
                AssetBundle assetBundle = AssetBundle.LoadFromMemory(binary);
                if (!assetBundle)
                {
                    DebugEx.LogError("create scene assetbundle " + path + " failed !!!");
                }

                operation.mLoadedDependenciesAssetSize += sceneAssetBundleSize;

                AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(FileUtil.GetFileName(path, false));
                operation.asyncOperation = asyncOperation;
                yield return(asyncOperation);

                HandleResponse();

                operation.asyncOperation = null;
                operation.mComplete      = true;
                operation.mResource      = null;
                if (handle != null)
                {
                    handle();
                }
            }
            else
            {
                ResourceUnit   level          = new ResourceUnit(null, 0, null, path, resourceType);
                string         sceneName      = FileUtil.GetFileName(path, true);
                AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneName);
                operation.asyncOperation = asyncOperation;
                yield return(asyncOperation);

                HandleResponse();

                operation.asyncOperation = null;
                operation.mComplete      = true;
                if (handle != null)
                {
                    handle();
                }
            }
        }
Ejemplo n.º 28
0
 public static bool Equals(string typeStr, EResourceType type)
 {
     return(Equals(type, typeStr));
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Deactivates tasks requested by a certain action.
        /// </summary>
        //// <param name="removeaction">The Action I was talking about</param>
        // private void DeactivateAction(IPlatformAction removeaction)
        // {
        // mPlatformActions.Remove(removeaction);
        // }

        #region Looking for Resources

        /// <summary>
        /// Uses BFS to find the nearest Platform holding a resource you want to get. Might be expensive...
        /// </summary>
        /// <param name="destination">The platform you start the bfs from.</param>
        /// <param name="res">The resourcetype to look for.</param>
        /// <returns>The platform with the desired resource, if it exists, null if not</returns>
        private PlatformBlank FindBegin(PlatformBlank destination, EResourceType res)
        {
            var visited = new List <PlatformBlank>();

            var currentlevel = new List <PlatformBlank>();

            currentlevel.Add(destination);

            //Check whether the platform has the resource itself
            if (destination.GetPlatformResources()
                .Any(resource => resource.Type == res))
            {
                return(destination);
            }

            var nextlevel = new List <PlatformBlank>();

            while (currentlevel.Count > 0)
            {
                //Create the next level of BFS. While doing this, check if any platform has the resource you want. If yes return it.
                foreach (var platform in currentlevel)
                {
                    foreach (var edge in platform.GetInwardsEdges())
                    {
                        var candidatePlatform = (PlatformBlank)edge.GetParent();
                        //If true, we have already visited this platform
                        if (visited.Contains(candidatePlatform))
                        {
                            continue;
                        }
                        //Check for the resource
                        if (candidatePlatform.GetPlatformResources()
                            .Any(resource => resource.Type == res))
                        {
                            return(candidatePlatform);
                        }
                        //If true, this Platform has already been put in the next level
                        if (!nextlevel.Contains(candidatePlatform))
                        {
                            nextlevel.Add(candidatePlatform);
                        }
                    }

                    foreach (var edge in platform.GetOutwardsEdges())
                    {
                        var candidatePlatform = (PlatformBlank)edge.GetChild();
                        //If true, we have already visited this platform
                        if (visited.Contains(candidatePlatform))
                        {
                            continue;
                        }
                        //Check for the resource
                        if (candidatePlatform.GetPlatformResources().Any(resource => resource.Type == res))
                        {
                            return(candidatePlatform);
                        }
                        //If true, this Platform has already been put in the next level
                        if (!nextlevel.Contains(candidatePlatform))
                        {
                            nextlevel.Add(candidatePlatform);
                        }
                    }
                    //mark that you have visited this platform now
                    visited.Add(platform);
                }

                //Update levels
                currentlevel = nextlevel;
                nextlevel    = new List <PlatformBlank>();
            }
            return(null);
        }
Ejemplo n.º 30
0
 public static extern IntPtr FindResource(IntPtr hModule, int id, EResourceType type);
Ejemplo n.º 31
0
        void DownLoadScene(string name, string path, _DelegateAssetsResource onLoadOK, EResourceType type)
        {
            string[]       deps  = _manifest.GetAllDependencies(path);
            Queue <string> queue = new Queue <string>(deps.Length);

            for (int i = 0, imax = deps.Length; i < imax; ++i)
            {
                queue.Enqueue(deps[i]);
            }

            DownLoadResInfo info = new DownLoadResInfo();

            info.Assets = new AssetsResource();
            info.Assets.SetNameAndPath(name, path, type);
            info.MainAbPath       = path;
            info.DependenceAbPath = queue;
            info.onLoadComplete   = delegate(AssetsResource ar)
            {
                if (ar != null)
                {
                    ar.AddRef();
                    onLoadOK(ar);
                }
                else
                {
                    onLoadOK(null);
                }
            };

            DownLoadMgr.Instance.AddToDownLoadQueue(info);
        }
Ejemplo n.º 32
0
 public CSResourceWWW(string name, string path, EResourceType type) : base(name, path, type)
 {
 }
Ejemplo n.º 33
0
 public KeywordResourceInfo(int resourceID, int publishmentSystemID, int keywordID, string title, string imageUrl, string summary, EResourceType resourceType, bool isShowCoverPic, string content, string navigationUrl, int channelID, int contentID, int taxis)
 {
     this.resourceID          = resourceID;
     this.publishmentSystemID = publishmentSystemID;
     this.keywordID           = keywordID;
     this.title          = title;
     this.imageUrl       = imageUrl;
     this.summary        = summary;
     this.resourceType   = resourceType;
     this.isShowCoverPic = isShowCoverPic;
     this.content        = content;
     this.navigationUrl  = navigationUrl;
     this.channelID      = channelID;
     this.contentID      = contentID;
     this.taxis          = taxis;
 }
Ejemplo n.º 34
0
 public UserLimit(string profile, EResourceType resourceType)
 {
     this.profile = profile;
     this.resourceType = resourceType;
 }