static void readFile()
    {
        string path     = System.Environment.CurrentDirectory + "\\BepInEx\\config\\PlanetFactoryData\\";
        string filename = string.Empty;

        try
        {
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            else
            {
                DataList.Clear();
                var f = Directory.GetFiles(path);
                foreach (var d in f)
                {
                    FactoryData data = new FactoryData();
                    filename = d.Split('\\').Last();
                    data.Import(d);
                    DataList.Add(data);
                }
            }
        }
        catch (Exception e)
        {
            Debug.LogError("readFileError");
            Debug.LogError(e.Message);
            FactoryData data = new FactoryData();
            data.Name = filename + ST.导入错误 + "!";
            DataList.Add(data);
        }
    }
Пример #2
0
        /// <summary>
        /// Add a new type into this pool.  If template already exists (via name), then type will not be added.
        /// Returns true if successfully added.
        /// </summary>
        public bool AddType(string typeName, GameObject template, int startCapacity, int maxCapacity, Transform defaultParent = null)
        {
            if (mFactory.ContainsKey(typeName))
            {
                return(false);
            }

            if (poolHolder == null) //default holder to self
            {
                poolHolder = transform;
            }

            FactoryData newData = new FactoryData();

            newData.name          = typeName;
            newData.template      = template;
            newData.startCapacity = startCapacity;
            newData.maxCapacity   = maxCapacity;
            newData.defaultParent = defaultParent;

            newData.Init(group, poolHolder);

            mFactory.Add(typeName, newData);

            return(true);
        }
    public void AddChangeBuild(FactoryData data)
    {
        BuildName.Clear();
        ui.SelectBuild.ClearOptions();
        int i = 0;

        BuildName.Add("NULL", 0);
        foreach (var d in data.ItemNeed)
        {
            var id   = d.Key;
            var item = LDB.items.Select(id);
            if (item != null && item.prefabDesc.isAssembler)
            {
                BuildName.Add(item.name, d.Key);
            }
        }
        var Oldre = data.GetAllRecipe();

        foreach (var d in Oldre)
        {
            var recipe = LDB.recipes.Select(d);
            if (recipe != null)
            {
                BuildName.Add(ST.old + ":" + recipe.name, -d);
            }
        }
        ui.SelectBuild.AddOptions(BuildName.Keys.ToList());
    }
 void ClearData()
 {
     FData.PasteClear();
     FData.NewData();
     SelectData  = null;
     PastIngData = null;
     noItem      = string.Empty;
     AreaFalse();
 }
Пример #5
0
    public void TryLoad()
    {
        string filePath = Application.persistentDataPath + "/" + saveFileName;

        if (System.IO.File.Exists(filePath))
        {
            FactoryData data = DataManager.XMLUnmarshalling <FactoryData>(filePath);
            Load(data);
        }
    }
Пример #6
0
 /// <summary>
 /// 获取蓝图预览
 /// </summary>
 /// <param name="x">x旋转</param>
 /// <param name="y">y旋转</param>
 /// <param name="data">数据</param>
 /// <returns></returns>
 public Texture2D GetImg(int x, int y, FactoryData data)
 {
     if (this.x == x && this.y == y)
     {
         return(Img);
     }
     this.x = x;
     this.y = y;
     return(Fresh(data));
 }
Пример #7
0
        /// <summary>
        /// 加工厂概况信息
        /// </summary>
        /// <param name="list"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private FactoryData CreatGuideData(List <TbDistributionPlanInfo> orderList, int type)
        {
            var production = new FactoryItmeData();
            var delivery   = new FactoryItmeData();
            var ps         = orderList;

            if (type == 1)//本月
            {
                var o = orderList.Where(p => p.InsertTime.Value.Month == DateTime.Now.Month).ToList();
                production.OrderCount = o.Count;
                //加急,滞后
                var zh = o.Where(p => (p.FinishProcessingDateTime.HasValue && p.DistributionTime < p.FinishProcessingDateTime) ||
                                 (p.FinishProcessingDateTime == null && p.DistributionTime < DateTime.Now.Date)).ToList();
                production.OrderRate = GetJJData(o);
                production.OtherRate = GetJJData(zh);
                ps = orderList.Where(p => p.DistributionTime.Value.Month == DateTime.Now.Month).ToList();
                //超期配送
                var cqps = ps.Where(p => p.DistributionStart == "配送完成" && p.DistributionTime < p.DeliveryCompleteTime).ToList();
                delivery.OrderCount = cqps.Count;
                delivery.OrderRate  = GetJJData(cqps);
                //超期未配送
                var cqwps = ps.Where(p => p.DistributionStart == "未配送" && p.DistributionTime < DateTime.Now.Date).ToList();
                delivery.OtherCount = cqwps.Count;
                delivery.OtherRate  = GetJJData(cqwps);
                //生产及时率=按时完成数/应加工完成数
                production.TotalRate = GetjslData(ps);
            }
            else
            {
                delivery.OrderCount   = orderList.Count(p => p.DistributionStart == "配送完成");
                production.OrderCount = orderList.Count(p => p.ProcessingState == "Finishing");
                production.OrderRate  = orderList.Where(p => p.ProcessingState == "Finishing").Sum(p => p.WeightTotal).Value;

                //生产及时率=按时完成数/应加工完成数
                var tps = orderList.Where(p => p.DistributionTime.Value < DateTime.Now.Date).ToList();
                production.TotalRate = GetjslData(tps);
            }

            //准时配送率=按期配送数 /(累计配送数+超期未配送数)
            decimal asps   = ps.Where(p => p.DistributionStart == "配送完成" && p.DistributionTime >= p.DeliveryCompleteTime).Count();
            decimal ljps   = ps.Where(p => p.DistributionStart == "配送完成").Count();
            decimal cqwpsc = ps.Where(p => p.DistributionStart == "未配送" && p.DistributionTime < DateTime.Now.Date).Count();

            if (delivery.OrderCount > 0)
            {
                delivery.TotalRate = decimal.Round((asps / (ljps + cqwpsc)) * 100, 2);//配送准时率
            }
            var retData = new FactoryData()
            {
                Production = production,
                Delivery   = delivery
            };

            return(retData);
        }
Пример #8
0
        //- @Register -//
        public override void Register()
        {
            String blogGuid = ParameterMap.PeekSafely("blogGuid");

            if (String.IsNullOrEmpty(blogGuid))
            {
                throw new System.Configuration.ConfigurationErrorsException("blogPage parameter is required for the Blog component.");
            }
            //+ factory
            AddFactory(FactoryData.Create("Minima.Web.Processing.ProcessorFactory, Minima.Web"));
            //+ processor
            AddProcessor(ProcessorData.Create <ProcessorData>("__$Minima$InitProcessor", new Object[] { blogGuid }));
        }
Пример #9
0
        public override int GetHashCode()
        {
            unchecked
            {
                if (IsAmbient)
                {
                    return(AmbientToken.GetHashCode());
                }

                var result = FactoryType.GetHashCode();
                result = (result * 397) ^ FacetType.GetHashCode();
                result = (result * 397) ^ FactoryData.GetHashCode();
                return(result);
            }
        }
Пример #10
0
    /// <summary>
    /// 刷新预览
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    public Texture2D Fresh(FactoryData data)
    {
        Img = new Texture2D(imgh * 2 + 1, imgh);
        for (int i = 1; i <= imgh; i++)
        {
            Img.SetPixel(imgh + 1, i, Color.black);
        }
        List <Vector3> belt = new List <Vector3>();

        foreach (var d in data.AllData)
        {
            switch (d.type)
            {
            case EDataType.Assembler:
                SetBuildColor(GetImgPos(d.Pos), new Color(232f / 256f, 253 / 256f, 77 / 256f), -1, 1, -1, 1);
                break;

            case EDataType.Belt:
                belt.Add(d.Pos);
                break;

            case EDataType.Lab:
                SetBuildColor(GetImgPos(d.Pos), Color.white, -2, 2, -2, 2);
                break;

            case EDataType.Station:
                SetBuildColor(GetImgPos(d.Pos), new Color(218f / 256f, 83f / 256f, 2f / 256f), -3, 3, -3, 3);
                break;

            case EDataType.PowGen:
                SetBuildColor(GetImgPos(d.Pos), new Color(108f / 256f, 2f / 256f, 208f / 256f), -1, 1, -1, 1);
                break;

            case EDataType.Gamm:
                SetBuildColor(GetImgPos(d.Pos), new Color(108f / 256f, 2f / 256f, 208f / 256f), -2, 2, -2, 2);
                break;
            }
        }
        foreach (var d in belt)
        {
            SetBuildColor(GetImgPos(d), new Color(24f / 256f, 194 / 256f, 254 / 256f), 0, 1);
        }
        Img.Apply();
        return(Img);
    }
Пример #11
0
        /// <summary>
        /// Releases all currently spawned objects of all types.
        /// </summary>
        public void ReleaseAll()
        {
            foreach (KeyValuePair <string, FactoryData> itm in mFactory)
            {
                FactoryData factory = itm.Value;

                for (int i = 0; i < factory.actives.Count; i++)
                {
                    PoolDataController pdc = factory.actives[i];

                    pdc.Despawn();

                    factory.Release(pdc, false);
                }

                factory.actives.Clear();
            }
        }
Пример #12
0
        /// <summary>
        /// Releases all currently spawned objects of all types.
        /// </summary>
        public void ReleaseAll()
        {
            foreach (KeyValuePair <string, FactoryData> itm in mFactory)
            {
                FactoryData factory = itm.Value;

                for (int i = 0; i < factory.actives.Count; i++)
                {
                    PoolDataController pdc = factory.actives[i];

                    pdc.SendMessage(OnDespawnMessage, null, SendMessageOptions.DontRequireReceiver);

                    factory.Release(pdc, false);
                }

                factory.actives.Clear();
            }
        }
Пример #13
0
        public FactoryData FactoryMethod(Datas datas)
        {
            FactoryData factoryData = null;

            switch (datas)
            {
            case Datas.Json:
                factoryData = new JsonData();
                break;

            case Datas.Xml:
                factoryData = new XmlData();
                break;

            default:
                break;
            }
            return(factoryData);
        }
Пример #14
0
    public FactoryData Save()
    {
        FactoryData data = new FactoryData()
        {
            working         = working,
            lastTimeCreated = lastTimePieceCreated.ToString()
        };

        if (worker != null)
        {
            data.workerId = worker.id;
        }
        if (pieceToCreate != null)
        {
            data.recipeId = pieceToCreate.id;
        }

        return(data);
    }
Пример #15
0
        //////////////////////////////////////////////////////////
        // Methods


        /// <summary>
        /// Add a new type into this pool.  The type name is based on template's name.  If template
        /// already exists (via name), then type will not be added.  Returns true if successfully added.
        /// </summary>
        public bool AddType(Transform template, int startCapacity, int maxCapacity, Transform defaultParent = null)
        {
            if (mFactory.ContainsKey(template.name))
            {
                return(false);
            }

            FactoryData newData = new FactoryData();

            newData.template      = template;
            newData.startCapacity = startCapacity;
            newData.maxCapacity   = maxCapacity;
            newData.defaultParent = defaultParent;

            newData.Init(group, poolHolder);

            mFactory.Add(template.name, newData);

            return(true);
        }
    void CopyData()
    {
        AreaTrue();
        var factory = GetFactory();

        if (factory != null)
        {
            FData.NewData();
            FData.CopyData(factory);
            for (int i = 0; i < 30; i++)
            {
                StartCoroutine(FData.Data.CheckBelt((float)(0.1 + 0.1 * i)));
            }
            SelectData = FData.Data;
            info       = ST.制 + ST.成功 + ":" + SelectData.AllData.Count;
            string temps;
            SelectData.CheckItem(null, out string ts1, out int i1, out temps, out int i2);
            info += "\n" + temps;
        }
    }
Пример #17
0
        static void Main(string[] args)
        {
            GetAppSettingsFile();

            #region NewsCountConfig
            var emlakCount = _iconfiguration["NewsCountConfig:emlakCount"];

            var aileCount      = _iconfiguration.GetSection("NewsCountConfig").GetSection("aileCount").Value;
            var yeniBirIsCount = _iconfiguration.GetSection("NewsCountConfig").GetSection("yeniBirIsCount").Value;
            var bigparaCount   = _iconfiguration.GetSection("NewsCountConfig").GetSection("bigparaCount").Value;
            var mahmureCount   = _iconfiguration.GetSection("NewsCountConfig").GetSection("mahmureCount").Value;
            #endregion


            #region RedisConfig


            var         redisKey    = _iconfiguration.GetSection("RedisConfig").GetSection("Key").Value;
            var         timeOut     = _iconfiguration.GetSection("RedisConfig").GetSection("Timeout").Value;
            RedisHelper redisHelper = new RedisHelper();
            redisHelper.ReadData(redisKey);
            #endregion
            SqlHelper.TruncateDb();

            #region FactoryPattern
            Creater     creater  = new Creater();
            FactoryData jsonData = creater.FactoryMethod(Datas.Json);
            FactoryData xmlData  = creater.FactoryMethod(Datas.Xml);
            jsonData.DataType();
            xmlData.DataType();
            #endregion

            var allDatas = SqlHelper.SelectDb();
            var list     = SqlHelper.SelectedData(Convert.ToInt32(emlakCount), Convert.ToInt32(aileCount), Convert.ToInt32(yeniBirIsCount), Convert.ToInt32(bigparaCount), Convert.ToInt32(mahmureCount));
            var list2    = SqlHelper.SelectSomeData();

            redisHelper.SaveBigData(redisKey, timeOut, list);

            Console.WriteLine("Press to any key...");
            Console.ReadLine();
        }
Пример #18
0
        //- @Register -//
        public override void Register()
        {
            String blogGuid = ParameterMap.PeekSafely("blogGuid");

            if (String.IsNullOrEmpty(blogGuid))
            {
                throw new System.Configuration.ConfigurationErrorsException("blogPage parameter is required for the Blog component.");
            }
            //+ factory
            AddFactory(FactoryData.Create("Minima.Web.Processing.HandlerFactory, Minima.Web"));
            AddFactory(FactoryData.Create("Minima.Web.Processing.ProcessorFactory, Minima.Web"));
            //+ processor
            AddProcessor(ProcessorData.Create <ProcessorData>("__$Minima$InitProcessor", new Object[] { blogGuid }));
            //+ handler
            AddEndpoint(EndpointData.Create(SelectorType.EndsWith, "/rsd.xml", "__$Minima$BlogDiscovery"));
            AddEndpoint(EndpointData.Create(SelectorType.EndsWith, "/wlwmanifest.xml", "__$Minima$WindowsLiveWriterManifest"));
            AddEndpoint(EndpointData.Create(SelectorType.EndsWith, "/blogmap.xml", "__$Minima$SiteMap"));
            AddEndpoint(EndpointData.Create(SelectorType.Contains, "/xml-rpc", "__$Minima$MetaWeblogApi"));
            AddEndpoint(EndpointData.Create(SelectorType.Contains, "/xml-rpc/", "__$Minima$MetaWeblogApi"));
            AddEndpoint(EndpointData.Create(SelectorType.Contains, "/imagestore", "__$Minima$Image"));
        }
    private void PasteData(FactoryData data, ERotationType rotationType = ERotationType.Null)
    {
        var player = GetPlayer();

        if (player != null && PastIngData == null)
        {
            FactoryTask task = new FactoryTask(data);            //新建粘贴任务
            //检测是否够物品
            if (task.CheckCanPaste(player))
            {
                task.PasteDate(player, area, rotationType);                //进行粘贴任务
                info        = data.Name + ST.粘贴 + ST.成功;
                PastIngData = task;
            }
            else
            {
                //提示物品不足
                info = data.Name + ST.物品 + ST.o + ST.足 + "\n" + ST.noItemTip;
            }
        }
    }
Пример #20
0
    public void Load(FactoryData data)
    {
        if (data.workerId != null)
        {
            worker = ((Worker.HiredWorker)Inventory.Instance.workers[data.workerId]).worker;
        }

        if (data.recipeId != null)
        {
            ui.UpdateRecipe(data.recipeId);
        }

        lastTimePieceCreated = TimeSpan.Parse(data.lastTimeCreated);

        if (data.working)
        {
            secondsToCreate = pieceToCreate.secondsNeeded;
            working         = true;
        }

        ui.UpdateGUI();
    }
Пример #21
0
 public void Init()
 {
     Data                   = new FactoryData();
     PreInserterData        = new List <Inserter>();
     eIdMap                 = new Dictionary <int, int>();
     posSet                 = new Dictionary <int, int>();
     floatPosSet            = new Dictionary <long, int>();
     eidSet                 = new HashSet <int>();
     preIdMap               = new Dictionary <int, MyPreBuildData>();
     BeltEIdMap             = new Dictionary <int, int>();
     belts                  = new BeltQueue();
     preConnMap             = new Dictionary <int, MyPreBuildData>();
     addBuildData           = new List <MyPreBuildData>();
     AfterSetData           = new List <MyPreBuildData>();
     error                  = false;
     BeltCount              = 0;
     RotationType           = ERotationType.Null;
     playerHaveBeltItem     = true;
     playerHaveInserterItem = true;
     errorMsg               = string.Empty;
     InserterConnt          = 0;
 }
Пример #22
0
        /// <summary>
        /// Releases all currently spawned objects of all types.
        /// </summary>
        public void ReleaseAll()
        {
            foreach (KeyValuePair <string, FactoryData> itm in mFactory)
            {
                FactoryData factory = itm.Value;

                for (int i = 0; i < factory.actives.Count; i++)
                {
                    PoolDataController pdc = factory.actives[i];

                    if (despawnCallback != null)
                    {
                        despawnCallback(pdc);
                    }

                    pdc.Despawn();

                    factory.ReleaseIgnoreActiveList(pdc);
                }

                factory.actives.Clear();
            }
        }
    FactoryData GetData(int i)
    {
        int index = atPage * 7 + i;

        if (index < DataList.Count)
        {
            if (CheckData())
            {
                var player = GameMain.mainPlayer;
                DataList[index].CheckItem(player, out haveItem, out haveItemCount, out noItem, out noItemCount);
            }
            else
            {
                DataList[index].CheckItem(null, out haveItem, out haveItemCount, out noItem, out noItemCount);
            }
            isAreaSelect = false;
            isLookLocal  = false;
            SelectData   = DataList[index];
            FData.Data   = SelectData;
            return(DataList[index]);
        }
        return(null);
    }
Пример #24
0
    IEnumerator Init()
    {
        Preset();

        data = new FactoryData(new Vector2Int(30, 70));
        RoomFactory startTile = new RoomFactory(Vector2Int.zero, data);

        data._workingFactories.Add(startTile);
        for (; data._workingFactories.Count != 0;)
        {
            TileFactory currentFactory = data._workingFactories[0].Create();
            CreateModel(currentFactory);
            yield return(new WaitForSeconds(0.1f));
        }

        //foreach(var iter in data._allTileFactories)
        //{
        //    GameObject createdModel;
        //    if(iter.Value is RoomFactory)
        //    {
        //        createdModel = Instantiate(models[0]);
        //        createdModel.transform.position = new Vector3(iter.Key.x * 5f, 0f, iter.Key.y * 5f);
        //    }
        //    else if (iter.Value is BridgeFactory)
        //    {
        //        BridgeFactory bridge = iter.Value as BridgeFactory;
        //        List<Vector2Int> keyInstance = preset.Keys.First(item => item.Except(bridge.entrances).Count() == 0);

        //        ModelSet modelset = preset[keyInstance];

        //        createdModel = Instantiate(modelset.prefab);
        //        createdModel.transform.position = new Vector3(iter.Key.x * 5f, 0f, iter.Key.y * 5f);
        //        createdModel.transform.rotation = modelset.rotate;
        //    }
        //}
    }
Пример #25
0
        PoolDataController _Spawn(string type, string name, Transform toParent, Vector3?position, Quaternion?rot, GenericParams parms)
        {
            PoolDataController entityRet = null;

            FactoryData dat = null;

            if (string.IsNullOrEmpty(type))
            {
                //this should only be used if there's just one type
                if (factory != null && factory.Length > 0)
                {
                    dat = mFactory[factory[0].template.name];
                }
                else if (mFactory.Count > 0)
                {
                    foreach (var pair in mFactory)
                    {
                        dat = pair.Value;
                        break;
                    }
                }
            }
            else
            {
                mFactory.TryGetValue(type, out dat);
            }

            if (dat != null)
            {
                var pdc = dat.Allocate(group, name, toParent == null ? dat.defaultParent == null ? transform : null : toParent);

                if (pdc != null)
                {
                    entityRet = pdc;

                    var t = entityRet.transform;

                    if (position.HasValue)
                    {
                        t.position = position.Value;
                    }
                    if (rot.HasValue)
                    {
                        t.rotation = rot.Value;
                    }

                    pdc.Spawn(parms);

                    if (spawnCallback != null)
                    {
                        spawnCallback(pdc);
                    }
                }
                else
                {
                    Debug.LogWarning("Failed to allocate type: " + type + " for: " + name);
                }
            }
            else
            {
                Debug.LogWarning("No such type: " + type + " attempt to allocate: " + name);
            }

            return(entityRet);
        }
Пример #26
0
        public List <Entities.Concrete.Employee.Employee> GetAllEmployees()
        {
            IEmployeeData employeeData = FactoryData.CreateEmployeeData();

            return(employeeData.GetAllEmployees());
        }
Пример #27
0
        public Entities.Concrete.Employee.Employee GetEmployeeByCompanyID(long prmCompanyID)
        {
            IEmployeeData employeeData = FactoryData.CreateEmployeeData();

            return(employeeData.GetEmployeeByCompanyID(prmCompanyID));
        }
Пример #28
0
        public bool UpdateEmployee(Entities.Concrete.Employee.Employee prmEmployee)
        {
            IEmployeeData employeeData = FactoryData.CreateEmployeeData();

            return(employeeData.UpdateEmployee(prmEmployee));
        }
Пример #29
0
        public bool ValidateEmployee(long prmCompanyID, string prmUserName, bool prmIsUpdated)
        {
            IEmployeeData employeeData = FactoryData.CreateEmployeeData();

            return(employeeData.ValidateEmployee(prmCompanyID, prmUserName, prmIsUpdated));
        }
Пример #30
0
        public bool DeleteEmployee(long prmCompanyID)
        {
            IEmployeeData employeeData = FactoryData.CreateEmployeeData();

            return(employeeData.DeleteEmployee(prmCompanyID));
        }