Пример #1
0
        private async Task LoadArticlesIntoFeed(FeedModel feed, int max = -1)
        {
            if (max == -1)
            {
                max = 100;
            }
            for (int i = 0; i < max; i++)
            {
                if (feed.AllArticles.Count <= i)
                {
                    var stringGuid = feed.Guid.ToString();
                    var realmax    = max == 0 ? 0 : max - i;
                    var relations  = await _sqliteService.GetByCondition <FeedArticleRelationEntity>(s => s.FeedGuid == stringGuid, s => s.Index, false, realmax, i);

                    foreach (var feedArticleRelationEntity in relations)
                    {
                        var article = await LoadHelper.LoadForFeed(feedArticleRelationEntity.ArticleId, feed, _sqliteService, _imageDownloadService);

                        feed.AllArticles.Add(article);
                    }
                }

                _imageDownloadService.Download(feed);

                //no more entries
                if (feed.AllArticles.Count <= i)
                {
                    return;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 创建界面节点
        /// </summary>
        /// <param name="panel"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public static void CreateUIPanelTrans(InternalUIPanel panel)
        {
            RectTransform panelRootTrans = UILocate.UICenter.GetUILayerTrans(panel.Layer, panel.CanvasType);

            if (panelRootTrans == null)
            {
                UILocate.Log.LogError("创建界面节点失败,没有找到层级节点>>>", panel.Layer, panel.CanvasType);
                return;
            }
            if (string.IsNullOrEmpty(panel.UIPrefabName))
            {
                UILocate.Log.LogError("创建界面节点失败,没有声明预制体>>>", panel.UIPrefabName);
                return;
            }
            GameObject goAsset = LoadHelper.LoadPrefab(panel.UIPrefabName);

            if (goAsset == null)
            {
                UILocate.Log.LogError("创建界面节点失败,没有找到预制体>>>", panel.UIPrefabName);
                return;
            }
            GameObject panGo = GameObject.Instantiate(goAsset);

            panGo.transform.SetParent(panelRootTrans, false);
            panGo.transform.Reset();

            //设置节点
            panel.SetTransform(panGo.transform);
            panel.Awake();
        }
Пример #3
0
 void Start()
 {
     gm = GameManager.instance;
     // without this, the scene defaults to the last used fade object, which is transparent (no fade from black effect).
     fadeImage.color = new Color(fadeImage.color.r, fadeImage.color.g, fadeImage.color.b, 1f);
     instance        = LoadHelper.setInstance <UIFade>(gameObject, this, instance);
 }
Пример #4
0
        public void ScanTypesTest()
        {
            var sw = Stopwatch.StartNew();

            LoadHelper.FromAssemblyOf <IAliceService>();
            LoadHelper.FromAssemblyOf <AliceService>();
            LoadHelper.FromAssemblyOf <IBobService>();
            LoadHelper.FromAssemblyOf <BobService>();
            LoadHelper.FromAssemblyOf <ICarolService>();
            LoadHelper.FromAssemblyOf <CarolService>();

            sw.Stop();
            var i0 = sw.ElapsedMilliseconds;

            LoadHelper.LoadMode = LoadTypesMode.LoadByDirectory;

            sw.Restart();

            LoadHelper.LoadTypes();

            sw.Stop();
            var i1 = sw.ElapsedMilliseconds;

            Assert.True(LoadHelper.LoadSpecifyTypes().Count > 0);
        }
Пример #5
0
    public static IServiceCollection AddServiceDiscovery(this IServiceCollection services, Type serviceDefineType,
                                                         string consulAddress)
    {
        services.TryAddSingleton <IConsulClient>(_ => new ConsulClient(x =>
        {
            x.Address = new Uri(consulAddress);
        }));
        services.AddTransient <ConsulServiceDiscoveryDelegatingHandler>();

        var consulClient = services.BuildServiceProvider().GetService <IConsulClient>();
        var serviceNames = consulClient?.Catalog.Services().Result.Response;

        var i = LoadHelper.GetTypePairs(serviceDefineType)
                .Where(p => p.InterfaceType?.Namespace is not null && p.ImplementationType is null);

        // foreach (var typeWithUri in typeWitUris)
        // {
        //     services.AddHttpClient(typeWithUri.Type.Namespace)
        //         .AddHttpMessageHandler<ConsulServiceDiscoveryDelegatingHandler>();
        //     services.AddScoped(typeWithUri.Type, _ => methodInfo.MakeGenericMethod(typeWithUri.Type)
        //         .Invoke(services.BuildServiceProvider().GetService<ZaabyClient>(), null));
        // }

        return(services);
    }
Пример #6
0
    private void RealLoad(LoadHelper loadhelper)
    {
        if (loadhelper == null)
        {
            return;
        }
        if (resCache.ContainsKey(loadhelper.Url))
        {
            loadhelper.onLoadOK(resCache[loadhelper.Url]);
            return;
        }

        //先看是否已经开始加载;
        for (int i = 0, iMax = loadingList.Count; i < iMax; i++)
        {
            if (loadingList[i].Url == loadhelper.Url)
            {
                loadingList[i].onLoadOK += loadhelper.onLoadOK;
                return;
            }
        }

        loadhelper.StartLoad();
        loadingList.Add(loadhelper);
    }
Пример #7
0
        /// <summary>
        /// </summary>
        /// <param name="hb"/>
        /// <param name="ao"/>
        /// <param name="now"/>
        /// <param name="handled"/>
        public void ON_START_TASK0(Mozart.SeePlan.Simulation.IHandlingBatch hb, Mozart.Simulation.Engine.ActiveObject ao, DateTime now, ref bool handled)
        {
            FabLot lot = hb.ToFabLot();

            hb.Apply((x, y) => LoadHelper.OnStartTask(x as FabLot));

            InFlowMaster.ChangeWipLocation(hb, EventType.TrackIn);

            if (ao is AoEquipment)
            {
                FabAoEquipment eqp = ao as FabAoEquipment;

                MaskMaster.StartTask(lot, eqp);
                JigMaster.StartTask(lot, eqp);

                //TODO : 설비의 Property로 작성필요 (LastPlan의 Plan을 보고)
                if (lot.CurrentFabPlan.CurrentRecipeTime != null)
                {
                    eqp.IsEqpRecipeRun = true;
                }
                else
                {
                    eqp.IsEqpRecipeRun = false;
                }
            }

            OutCollector.Write_Rtd_LotUpkTracking(lot);
        }
Пример #8
0
        private void ResLoaded(LoadHelper data)
        {
            if (data.loadError)
            {
                Log.Cly("load error Source:" + data.Url);
            }
            loaded++;
            if (!data.loadError)
            {
                successloaded++;
            }
            float rate = successloaded / (float)count;

            if (progress != null)
            {
                progress.Update(rate);
            }

            if (loaded >= count)
            {
                if (callBack != null)
                {
                    callBack(successloaded >= count);
                }
            }
        }
Пример #9
0
    public static IServiceCollection Register(this IServiceCollection services, Type defineType,
                                              ServiceLifetime serviceLifetime)
    {
        var typePairs = LoadHelper.GetTypePairs(defineType);

        return(services.Register(typePairs, serviceLifetime));
    }
Пример #10
0
        public static void LoadAllConfigBytes(HashSet <Type> types, Dictionary <string, byte[]> output)
        {
            if (Application.isEditor)
            {
                string dirPath = "Assets/Bundles/Config/";
                foreach (var _type in types)
                {
                    string    name  = _type.Name;
                    string    path  = dirPath + name + ".bytes";
                    TextAsset asset = LoadHelper.LoadTextAsset(path);  // ResourceHelper.LoadAsset<TextAsset>(path);
                    output[name] = asset.bytes;
                }
            }
            else
            {
                Dictionary <string, UnityEngine.Object> keys = ResourcesComponent.Instance.GetBundleAll("config.unity3d");

                var keysList = keys.Keys.ToList();
                for (int i = 0; i < keysList.Count; i++)
                {
                    TextAsset v   = (TextAsset)keys[keysList[i]];
                    string    key = keysList[i];
                    output[key] = v.bytes;
                }
            }
        }
Пример #11
0
        public GameObject Create()
        {
            AreaRootGo = new GameObject("Area_" + Id);

            //预制体
            GameObject assetGo = LoadHelper.LoadPrefab(Model.areaPrefab);

            AreaEnvGo = GameObject.Instantiate(assetGo);
            AreaEnvGo.transform.SetParent(AreaRootGo.transform);
            AreaEnvGo.transform.Reset();

            InitArea();

            //演员
            ActorRootGo = new GameObject("ActorRootGo");
            ActorRootGo.transform.SetParent(AreaRootGo.transform);
            ActorRootGo.transform.Reset();

            for (int i = 0; i < Model.actors.Count; i++)
            {
                ActorModel actorModel = Model.actors[i];
                CreateActorObj(actorModel);
            }
            return(AreaRootGo);
        }
Пример #12
0
        // GET: Contacts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Contacts contacts = db.Contacts.Find(id);

            if (contacts == null)
            {
                return(HttpNotFound());
            }

            #region Load country list for drop down list
            countries       = LoadHelper.Countries();
            ViewBag.country = from cL in countries
                              select new SelectListItem
            {
                Text  = cL.Name,
                Value = cL.Name
            };
            #endregion

            return(View(contacts));
        }
Пример #13
0
        public ActionResult Edit([Bind(Include = "Id,ContactType,MainName,TradeName,DocumentNumber,Birthday,Gender,Country,State,City,ZipCode,AddressLine1,AddressLine2")] Contacts contacts)
        {
            //Validates the information provided for an exiting Contact
            ValidationHelper.ContactInformation(ModelState, contacts);

            if (ModelState.IsValid)
            {
                db.Entry(contacts).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else
            {
                #region Reload country list for drop down list
                countries       = LoadHelper.Countries();
                ViewBag.country = from cL in countries
                                  select new SelectListItem
                {
                    Text  = cL.Name,
                    Value = cL.Name
                };
                #endregion
            }

            return(View(contacts));
        }
Пример #14
0
    /// <summary>
    /// 间隔repeatTime秒重复调用;
    /// </summary>
    private void UpdateLoad()
    {
        // Log.Wsy(string.Format ("ResManager {0:f2}s Repeat:current time={1:f2}) ",repeatRate,Time.time));
        LoadHelper loadObj = HasFreeLoader() ? GetFromWaitQueue() : null;

        while (loadObj != null)
        {
            RealLoad(loadObj);
            loadObj = HasFreeLoader() ? GetFromWaitQueue() : null;
        }

        if (loadingList.Count <= 0)
        {
            CancelInvoke("UpdateLoad");
            return;
        }
        removeList.Clear();
        for (int i = 0, iMax = loadingList.Count; i < iMax; i++)
        {
            loadObj = loadingList[i];
            if (loadObj.www.error != null)
            {
                //出现加载错误的处理方法;
                if (loadObj.NeedLoadAgain())
                {
                    loadQueueLow.Enqueue(loadObj);
                }
                else
                {
                    loadObj.loadError = true;
                    Log.Fatlin(string.Format("Load Error:{0}\n{1}", loadObj.www.url, loadObj.www.error));
                    ExecuteLoadOKCallback(loadObj);
                }
                removeList.Add(loadObj);
            }
            else if (loadObj.www.isDone)
            {
                //如果在加载过程中已经完成过一次对象加载;那么这里就不需要进行资源缓存;
                Log.Fatlin("Loaded:" + loadObj.Url + ">>>" + loadObj.baseUrl);
                if (resCache.ContainsKey(loadObj.Url) == false)
                {
                    resCache.Add(loadObj.Url, loadObj);
                }

                if (loadObj.needSave)
                {
                    SaveToLocal(loadObj.www.bytes, loadObj.Url);
                }
                removeList.Add(loadObj);
                ExecuteLoadOKCallback(loadObj);
            }
        }

        for (int i = 0, iMax = removeList.Count; i < iMax; i++)
        {
            loadingList.Remove(removeList[i]);
        }
    }
Пример #15
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            LoadHelper.Load(Content);

            manager = new GameManager();
            // TODO: use this.Content to load your game content here
        }
Пример #16
0
        async void LoadEffect()
        {
            parent   = GameFrameEntry.GetModule <UIModule>().UIRoot;
            uiCamera = GameFrameEntry.GetModule <UIModule>().UICamera;
            self     = await LoadHelper.LoadPrefab("TouchTrail");

            self.transform.SetParent(parent);
            self.transform.SetAsLastSibling();
            rect = self.GetComponent <RectTransform>();
        }
Пример #17
0
 public void InitPath(string localPath, string netPath, bool controlVersion = false)
 {
     _dataPath    = localPath + (localPath.EndsWith("/") ? "" : "/");
     _netDataPath = netPath + (netPath.EndsWith("/") ? "" : "/");
     LoadHelper.InitBaseUrl(_dataPath, _netDataPath);
     if (controlVersion)
     {
         GetRes(_netDataPath + versionXML, OnXmlLoaded);
     }
 }
Пример #18
0
 void LoadDDL()
 {
     string[] saves = LoadHelper.GetCharacterSaves();
     for (int i = 0; i < saves.Length; i++)
     {
         currMasterSave = LoadHelper.GetMasterSave(saves[i]);
         Debug.Log(saves[i]);
         GenerateSaveSlot(currMasterSave.saveObject.characterName, 250, 1, i + 1);
     }
     Instantiate(Resources.Load <GameObject>("Prefabs/NewCharacterSlot"), content.transform);
 }
Пример #19
0
        public static void RestoreRevision(int id, User u)
        {
            var ur        = GetById(id);
            var type      = (UploadTypes)Enum.Parse(typeof(UploadTypes), ur.Type);
            var byteArray = System.Text.Encoding.UTF8.GetBytes(ur.Data);
            var data      = new MemoryStream(byteArray);

            var loader = LoadHelper.GetLoader(type);

            loader.Load(data, u);
        }
Пример #20
0
        //获得实体配置
        private string GetEntityCnf(int entityConfId)
        {
            if (entityCnf.ContainsKey(entityConfId))
            {
                return(entityCnf[entityConfId]);
            }
            string jsonStr = LoadHelper.LoadString(ECSDefPath.GetEntityCnfName(entityConfId));

            entityCnf.Add(entityConfId, jsonStr);
            return(jsonStr);
        }
Пример #21
0
    public void GetByAttribute()
    {
        var types0 = LoadHelper.GetByAttributes(typeof(TestAttribute));
        var types1 = LoadHelper.GetByAttributes(typeof(TestDerivedAttribute));

        Assert.Equal(2, types0.Count);
        Assert.Single(types1);
        Assert.Contains(typeof(TestClassWithAttribute), types0);
        Assert.Contains(typeof(TestClassWithDerivedAttribute), types0);
        Assert.Contains(typeof(TestClassWithDerivedAttribute), types1);
    }
Пример #22
0
 void LoadDDL()
 {
     string[] saves = LoadHelper.GetWorldSaves();
     for (int i = 0; i < saves.Length; i++)
     {
         masterWorldSave = LoadHelper.GetMasterWorldSave(saves[i]);
         Debug.Log(saves[i]);
         GenerateWorldSlot(masterWorldSave.name, 0f, i + 1);
     }
     Instantiate(Resources.Load <GameObject>("Prefabs/NewWorldSlot"), content.transform);
 }
Пример #23
0
    public void GetByBaseType()
    {
        var types0 = LoadHelper.GetByBaseTypes(typeof(ITestInterface));
        var types1 = LoadHelper.GetByBaseTypes(typeof(IDerivedTestInterface));

        Assert.Equal(4, types0.Count);
        Assert.Contains(typeof(ITestInterface), types0);
        Assert.Contains(typeof(IDerivedTestInterface), types0);
        Assert.Contains(typeof(ClassWithInterface), types0);
        Assert.Contains(typeof(ClassWithDerivedInterface), types0);
    }
Пример #24
0
    void checkToggle(bool o)
    {
        if (toggle.isOn)
        {
            int             slotNum = Int32.Parse(this.gameObject.transform.Find("SlotNumBackground").transform.Find("SlotNum").GetComponent <Text>().text) - 1;
            MasterWorldSave s       = LoadHelper.GetMasterWorldSave(Directory.GetFiles(Application.persistentDataPath + "/Worlds/")[slotNum]);
            PersistentData.Instance.CurrentWorld = s;

            Debug.Log(PersistentData.Instance.CurrentWorld.name);
        }
    }
Пример #25
0
        public void GetByAttribute()
        {
            var types0 = LoadHelper.GetByAttribute <TestAttribute>();
            var types1 = LoadHelper.GetByAttribute(typeof(TestDerivedAttribute));

            Assert.Equal(2, types0.Count);
            Assert.Single(types1);
            Assert.Contains(typeof(TestClassWithAttribute), types0.Select(p => p.ImplementationType));
            Assert.Contains(typeof(TestClassWithDerivedAttribute), types0.Select(p => p.ImplementationType));
            Assert.Contains(typeof(TestClassWithDerivedAttribute), types1.Select(p => p.ImplementationType));
        }
Пример #26
0
        async void InitAirShip()
        {
            GameObject parent = GameObject.Find("ModelRoot");

            if (parent == null)
            {
                parent = new GameObject("ModelRoot");
            }
            model = await LoadHelper.LoadPrefab("AirShip");

            model.transform.SetParent(parent.transform, false);
        }
Пример #27
0
        private MapModel GetMapCnf(int mapId)
        {
            if (mapCnf.ContainsKey(mapId))
            {
                return(mapCnf[mapId]);
            }
            string   mapAssetName = ConfigDef.GetCnfNoExName("Map_" + mapId);
            string   jsonStr      = LoadHelper.LoadString(mapAssetName);
            MapModel model        = LCJson.JsonMapper.ToObject <MapModel>(jsonStr);

            mapCnf.Add(mapId, model);
            return(model);
        }
Пример #28
0
 private void ExecuteLoadOKCallback(LoadHelper loadObj)
 {
     if (loadObj.onLoadOK != null)
     {
         //try
         //{
         loadObj.onLoadOK(loadObj);
         //}
         //catch (Exception e)
         //{
         // Log.Fatlin("load回调错误:" + loadObj.Url + " 错误信息:" + e.ToString());
         //}
     }
 }
Пример #29
0
 private async System.Threading.Tasks.Task Load()
 {
     string[] str = /*  "prefabs/QCGC_Plane.prefab",*/
                    //"prefabs/seatClose.prefab",
                    //"prefabs/seatOpen.prefab",
                    //"ui/mainmenu/mainpanelui.prefab.unity3d"
     {
     };
     preLength = str.Length;
     for (int i = 0; i < str.Length; i++)
     {
         LoadHelper.LoadAsset <GameObject>(str[i], Load, LoadId);
     }
 }
Пример #30
0
        public void GetByBaseType()
        {
            var types0 = LoadHelper.GetByBaseType <ITestInterface>();
            var types1 = LoadHelper.GetByBaseType(typeof(IDerivedTestInterface));

            Assert.Equal(2, types0.Count);
            Assert.Contains(typeof(IDerivedTestInterface), types0.Select(p => p.InterfaceType));
            Assert.Contains(typeof(ClassWithInterface), types0.Select(p => p.ImplementationType));
            Assert.Contains(typeof(ClassWithDerivedInterface), types0.Select(p => p.ImplementationType));

            Assert.Single(types1);
            Assert.Null(types1[0].InterfaceType);
            Assert.Equal(typeof(ClassWithDerivedInterface), types1[0].ImplementationType);
        }
Пример #31
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag(TagManager.PLAYER);
     helper = GameObject.FindGameObjectWithTag(TagManager.MAIN_CAMERA).GetComponent<LoadHelper>();
 }