public FleetCreator( Expedition exp) { expedition = exp; ShipsForThisExp = new List<Ship>( Dock.Ships.FindAll(x => x.IsInFleet == false).OrderBy(x=>x.FuelMax).ThenBy(x=>x.Level)); Candidates = new Dictionary<Requirement, Ship>(); foreach (var req in exp.Requirements) { Candidates.Add(req, new Ship { ID_Ship = -1 }); } }
private void ShowExpedition(PointOfInterest poi, bool useCloseButton) { if (poi == null) { gameObject.SetActive(false); } else { if (poi.workingExpedition != null) { ShowExpedition(poi.workingExpedition, useCloseButton); return; } else { observingExpedition = null; selectedCrew = null; selectedDestination = poi; } RedrawWindow(); } }
public async Task <IEnumerable <StarSystem> > GetByExpedition(Expedition expedition) { if (null == expedition) { throw new ArgumentNullException("expedition"); } if (string.IsNullOrWhiteSpace(expedition.ObjectId)) { throw new Exception("Expedition.ObjectId is null"); } List <StarSystem> starSystemList = new List <StarSystem>(); int limit = 1000; int skip = 0; for (int i = 0; i < 10; i++) // 10K limit { var query = from item in ParseObject.GetQuery("System").Limit(limit).Skip(skip) where item.Get <string>("expedition") == expedition.ObjectId select item; IEnumerable <ParseObject> systems = await query.FindAsync(); foreach (var sys in systems) { starSystemList.Add(StarSystemMapper.Map(sys)); } if (systems.ToList().Count < limit) { break; } skip += limit; } return(starSystemList); }
public Expedition Create(string name, Character owner) { var expedition = new Expedition(); expedition.Id = ExpeditionIdManager.Instance.GetNextId(); expedition.MotherId = owner.Faction.Id; expedition.Name = name; expedition.OwnerId = owner.Id; expedition.OwnerName = owner.Name; expedition.UnitOwnerType = 0; expedition.PoliticalSystem = 1; expedition.Created = DateTime.Now; expedition.AggroLink = false; expedition.DiplomacyTarget = false; expedition.Members = new List <ExpeditionMember>(); expedition.Policies = GetDefaultPolicies(expedition.Id); var member = GetMemberFromCharacter(expedition, owner, true); expedition.Members.Add(member); return(expedition); }
// pour les expeditions public void detailsExpedition() { if (warManager.BattleDisplayChosen != 0) { Expedition currentExpedition = warManager.MyExpedition.Expeditions[warManager.BattleDisplayChosen - 1]; if (currentExpedition != null) { if (currentExpedition.ExpeditionStatus != ConstantsAndEnums.expeditionStatus.over) { cityNameCurrentExpedition.text = currentExpedition.City.NameOfCity.ToString(); nbrOfVikingStart.text = "Vikings sent : " + currentExpedition.NbrOfViking.ToString(); nbrOfSMStart.text = "SM sent : " + currentExpedition.NbrOfShieldMaiden.ToString(); expeditionStatus.text = "State : " + currentExpedition.ExpeditionStatus.ToString(); battleStatus.text = "Result : " + currentExpedition.BattleStatus.ToString(); if (currentExpedition.ExpeditionStatus == ConstantsAndEnums.expeditionStatus.battleOver) { nbrOfVikingEnd.text = "Remaining vkings : " + currentExpedition.NbrOfRemainingViking.ToString(); nbrOfSMEnd.text = "Remaining SM : " + currentExpedition.NbrOfRemainingSM.ToString(); goldGained.text = "Gold gained : " + currentExpedition.GoldBroughtBack.ToString(); woodGained.text = "Wood gained : " + currentExpedition.WoodBroughtBack.ToString(); ironGained.text = "Iron gained : " + currentExpedition.IronBroughtBack.ToString(); slaveGained.text = "Slave gained : " + currentExpedition.SlaveBroughtBack.ToString(); } else { nbrOfVikingEnd.text = "-"; nbrOfSMEnd.text = "-"; goldGained.text = "-"; woodGained.text = "-"; ironGained.text = "-"; slaveGained.text = "-"; } } } } }
public void SetExpedition(Expedition exp) { expedition = exp; var expSpeedup = progressService.Progress.expeditionSpeed - 100; InitTeam(); title.text = expedition.expeditionBase.name; description.text = expedition.expeditionBase.description; durationText.text = $"Duration: {expedition.expeditionBase.durationHours}h{(expSpeedup > 0 ? $" ({expSpeedup}% speedup)" : "")}"; xpText.text = $"{expedition.expeditionBase.xp} XP"; heroService.AllHeroes().ForEach(hero => { var heroPrefab = Instantiate(heroAvatarPrefab, heroListContainer); heroPrefab.SetHero(hero, indicateAvailability: true); if (hero.IsAvailable()) { heroPrefab.SetActive(IsHeroSelected(hero)); heroPrefab.AddClickListener(() => { heroPrefab.SetActive(ToggleHero(hero)); }); } heroPrefabs.Add(hero.id, heroPrefab); }); }
public void SetExpedition(Expedition e) { if (e == tracingExpedition) { return; } if (tracingExpedition != null) { tracingExpedition.SetTransmitter(null); } if (e == null) { tracingExpedition = null; SetActivationStatus(false); } else { tracingExpedition = e; if (energySupplied) { SetActivationStatus(true); } } }
private static void Expeditions() { var result = new List <Expedition>(); var assets = Assets.Original.XPathSelectElements("//Asset[Template='Expedition']").AsParallel(); assets.ForAll((asset) => { if (asset.XPathSelectElement("Values/Standard/Name").Value.Contains("Test")) { return; } ConsoleWriteGUID(asset.XPathSelectElement("Values/Standard/GUID").Value); var item = new Expedition(asset); if (item.Rewards.SelectMany(s => s.RewardPool).SelectMany(s => s.Items).Any()) { result.Add(item); } }); var document = new XDocument(); document.Add(new XElement("Expeditions")); document.Root.Add(result.Select(s => s.ToXml())); document.Save($@"{Program.PathRoot}\Modified\Assets_Expeditions.xml"); document.SaveIndent($@"{Program.PathViewer}\Resources\Assets\Expeditions.xml"); }
public void ShowExpedition(Expedition e) { switch (e.stage) { case Expedition.ExpeditionStage.OnMission: GetExploringMinigameController().Show(e); ChangeUIMode(UIMode.ExploringMinigame, true); break; case Expedition.ExpeditionStage.WayIn: case Expedition.ExpeditionStage.WayOut: case Expedition.ExpeditionStage.LeavingMission: if (currentMode != UIMode.GlobalMap) { ChangeUIMode(UIMode.GlobalMap, true); } else { GetGlobalMapCanvasController().RedrawMap(); } GetGlobalMapCanvasController().SelectExpedition(e.ID); break; } }
public void TestExpeditionCrossCalculation() { Assert.AreEqual(2d, (Velocity.FromMeterPerSecond(10d) / Duration.FromSecond(5)).MetersPerSquareSecond, DoubleDelta); Assert.AreEqual(50d, (Expedition.FromMetersPerSquareSecond(10d) * Duration.FromSecond(5)).MeterPerSecond, DoubleDelta); }
public void TestExpeditionCalculation() { Assert.AreEqual(9.4901418935110359d, (Expedition.FromGravity(10d) - Expedition.FromMetersPerSquareSecond(5d)).Gravity, DoubleDelta); Assert.AreEqual(10.509858106489d, (Expedition.FromGravity(10d) + Expedition.FromMetersPerSquareSecond(5d)).Gravity, DoubleDelta); }
public void TestExpeditionValue() { Assert.AreEqual(10d, Expedition.FromGravity(10d).Gravity, DoubleDelta); Assert.AreEqual(10d, Expedition.FromMetersPerSquareSecond(10d).MetersPerSquareSecond, DoubleDelta); }
public bool LoadGame(string fullname) { // отдельно функцию проверки и коррекции сейв-файла if (true) // <- тут будет функция проверки { // ОЧИСТКА StopAllCoroutines(); if (mainChunk != null) { Destroy(mainChunk.gameObject); } // очистка подписчиков на ивенты невозможна, сами ивенты к этому моменту недоступны Crew.Reset(); Shuttle.Reset(); Grassland.ScriptReset(); Expedition.GameReset(); Structure.ResetToDefaults_Static(); // все наследуемые resetToDefaults внутри colonyController.ResetToDefaults(); // подчищает все списки FollowingCamera.main.ResetLists(); //UI.current.Reset(); // НАЧАЛО ЗАГРУЗКИ BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(fullname, FileMode.Open); Time.timeScale = 0; gameSpeed = 0; GameMasterSerializer gms = (GameMasterSerializer)bf.Deserialize(file); file.Close(); #region gms mainPartLoading gameSpeed = gms.gameSpeed; lifeGrowCoefficient = gms.lifeGrowCoefficient; demolitionLossesPercent = gms.demolitionLossesPercent; lifepowerLossesPercent = gms.lifepowerLossesPercent; LUCK_COEFFICIENT = gms.luckCoefficient; sellPriceCoefficient = gms.sellPriceCoefficient; tradeVesselsTrafficCoefficient = gms.tradeVesselsTrafficCoefficient; upgradeDiscount = gms.upgradeDiscount; upgradeCostIncrease = gms.upgradeCostIncrease; environmentalConditions = gms.environmentalConditions; warProximity = gms.warProximity; difficulty = gms.difficulty; startGameWith = gms.startGameWith; prevCutHeight = gms.prevCutHeight; diggingSpeed = gms.diggingSpeed; pouringSpeed = gms.pouringSpeed; manufacturingSpeed = gms.manufacturingSpeed; clearingSpeed = gms.clearingSpeed; gatheringSpeed = gms.gatheringSpeed; miningSpeed = gms.miningSpeed; machineConstructingSpeed = gms.machineConstructingSpeed; day = gms.day; week = gms.week; month = gms.month; year = gms.year; millenium = gms.millenium; timeGone = gms.t; windVector = new Vector2(gms.windVector_x, gms.windVector_z); windTimer = gms.windTimer; windChangeTime = gms.windChangeTime; lifepowerTimer = gms.lifepowerTimer; labourTimer = gms.labourTimer; #endregion RecruitingCenter.SetHireCost(gms.recruiting_hireCost); Crew.LoadStaticData(gms.crewStaticSerializer); Shuttle.LoadStaticData(gms.shuttleStaticSerializer); // because of hangars GameObject g = new GameObject("chunk"); mainChunk = g.AddComponent <Chunk>(); mainChunk.LoadChunkData(gms.chunkSerializer); colonyController.Load(gms.colonyControllerSerializer); // < --- COLONY CONTROLLER Dock.LoadStaticData(gms.dockStaticSerializer); QuestUI.current.Load(gms.questStaticSerializer); Expedition.LoadStaticData(gms.expeditionStaticSerializer); FollowingCamera.main.WeNeedUpdate(); Time.timeScale = 1; gameSpeed = 1; savename = fullname; return(true); } else { UIController.current.MakeAnnouncement(Localization.GetAnnouncementString(GameAnnouncements.LoadingFailed)); return(false); } }
public bool LoadGame(string fullname) { bool debug_noresource = weNeedNoResources, refreshUI = false; Stream fs = File.Open(fullname, FileMode.Open); double realHashSum = GetHashSum(fs, true); var data = new byte[8]; fs.Read(data, 0, 8); double readedHashSum = System.BitConverter.ToDouble(data, 0); string errorReason = "reason not stated"; if (realHashSum == readedHashSum) { fs.Position = 0; SetPause(true); loading = true; // НАЧАЛО ЗАГРУЗКИ #region gms mainPartLoading data = new byte[5]; fs.Read(data, 0, data.Length); int saveSystemVersion = System.BitConverter.ToInt32(data, 0); // может пригодиться в дальнейшем gameMode = (GameMode)data[4]; // if (sessionPrepared) { ClearPreviousSessionData(); refreshUI = true; } else { PrepareSession(); } //start reading data = new byte[68]; fs.Read(data, 0, data.Length); gameSpeed = System.BitConverter.ToSingle(data, 0); lifeGrowCoefficient = System.BitConverter.ToSingle(data, 4); demolitionLossesPercent = System.BitConverter.ToSingle(data, 8); lifepowerLossesPercent = System.BitConverter.ToSingle(data, 12); LUCK_COEFFICIENT = System.BitConverter.ToSingle(data, 16); sellPriceCoefficient = System.BitConverter.ToSingle(data, 20); tradeVesselsTrafficCoefficient = System.BitConverter.ToSingle(data, 24); upgradeDiscount = System.BitConverter.ToSingle(data, 28); upgradeCostIncrease = System.BitConverter.ToSingle(data, 32); warProximity = System.BitConverter.ToSingle(data, 36); difficulty = (Difficulty)data[40]; int i = 41; prevCutHeight = data[i++]; day = data[i++]; month = data[i++]; year = System.BitConverter.ToUInt32(data, i); i += 4; timeGone = System.BitConverter.ToSingle(data, i); i += 4; gearsDegradeSpeed = System.BitConverter.ToSingle(data, i); i += 4; labourTimer = System.BitConverter.ToSingle(data, i); i += 4; RecruitingCenter.SetHireCost(System.BitConverter.ToSingle(data, i)); i += 4; gameID = System.BitConverter.ToInt32(data, i); i += 4; #endregion DockSystem.LoadDockSystem(fs, saveSystemVersion); var b = fs.ReadByte(); if (b == 1) { globalMap.Load(fs, saveSystemVersion); } if (loadingFailed) { errorReason = "global map error"; goto FAIL; } environmentMaster.Load(fs); if (loadingFailed) { errorReason = "environment error"; goto FAIL; } Artifact.LoadStaticData(fs); // crews & monuments if (loadingFailed) { errorReason = "artifacts load failure"; goto FAIL; } Crew.LoadStaticData(fs); if (loadingFailed) { errorReason = "crews load failure"; goto FAIL; } // if (colonyController == null) { PrepareColonyController(false); } // if (mainChunk == null) { mainChunk = Chunk.InitializeChunk(); } mainChunk.LoadChunkData(fs); if (loadingFailed) { errorReason = "chunk load failure"; goto FAIL; } else { if (blockersRestoreEvent != null) { blockersRestoreEvent(); } } Settlement.TotalRecalculation(); // Totaru Annihiration no imoto-chan if (loadingFailed) { errorReason = "settlements load failure"; goto FAIL; } colonyController.Load(fs); // < --- COLONY CONTROLLER if (loadingFailed) { errorReason = "colony controller load failure"; goto FAIL; } if (loadingFailed) { errorReason = "dock load failure"; goto FAIL; } QuestUI.current.Load(fs); if (loadingFailed) { errorReason = "quest load failure"; goto FAIL; } Expedition.LoadStaticData(fs); Knowledge.Load(fs); b = fs.ReadByte(); if (b == 1) { executingScenario = Scenario.StaticLoad(fs); } FollowingCamera.main.Load(fs); fs.Close(); FollowingCamera.main.WeNeedUpdate(); loading = false; currentSavename = fullname; //Debug.Log("recalculation event"); if (afterloadRecalculationEvent != null) { afterloadRecalculationEvent(); afterloadRecalculationEvent = null; } SetPause(false); //Debug.Log("power grid"); colonyController.FORCED_PowerGridRecalculation(); //Debug.Log("docks"); colonyController.SYSTEM_DocksRecalculation(); //Debug.Log("end"); if (refreshUI) { UIController.GetCurrent().GameWasReloaded(); } DEBUG_STOP = true; return(true); } else { AnnouncementCanvasController.MakeImportantAnnounce(Localization.GetAnnouncementString(GameAnnouncements.LoadingFailed) + " : hashsum incorrect"); if (soundEnabled) { audiomaster.Notify(NotificationSound.SystemError); } SetPause(true); fs.Close(); return(false); } FAIL: AnnouncementCanvasController.MakeImportantAnnounce(Localization.GetAnnouncementString(GameAnnouncements.LoadingFailed) + " : data corruption"); if (soundEnabled) { audiomaster.Notify(NotificationSound.SystemError); } Debug.Log(errorReason); SetPause(true); fs.Close(); if (debug_noresource) { weNeedNoResources = true; } return(false); }
public async Task <int> Create(Expedition model, string username, int clientTimeZoneOffset = 7) { int Created = 0; using (var transaction = this.dbContext.Database.BeginTransaction()) { try { int totalweight = 0; string code = GenerateCode("EFR-KB/EXP"); model.Code = code; model.Date = DateTimeOffset.Now; TransferOutDoc transferOutDoc = new TransferOutDoc(); foreach (var i in model.Items) { i.Id = 0; totalweight += i.Weight; string CodeTransferOut = GenerateCode("EFR-KB/EXP"); var SPK = dbContext.SPKDocs.Where(x => x.PackingList == i.PackingList).Single(); SPK.IsDistributed = true; transferOutDoc.Code = CodeTransferOut; transferOutDoc.Reference = model.Code; transferOutDoc.DestinationId = i.DestinationId; transferOutDoc.DestinationCode = i.DestinationCode; transferOutDoc.DestinationName = i.DestinationName; transferOutDoc.Remark = model.Remark; transferOutDoc.SourceId = i.SourceId; transferOutDoc.SourceCode = i.SourceCode; transferOutDoc.SourceName = i.SourceName; List <TransferOutDocItem> transferOutDocItems = new List <TransferOutDocItem>(); foreach (var d in i.Details) { d.Id = 0; var inven = dbContext.Inventories.Where(x => x.ItemArticleRealizationOrder == d.ArticleRealizationOrder && x.ItemCode == d.ItemCode && x.ItemName == d.ItemName && x.StorageId == i.SourceId).Single(); //inven.Quantity = inven.Quantity - d.SendQuantity; InventoryMovement movement = new InventoryMovement { After = inven.Quantity - d.SendQuantity, Before = inven.Quantity, Date = DateTimeOffset.Now, ItemArticleRealizationOrder = d.ArticleRealizationOrder, ItemCode = d.ItemCode, ItemDomesticCOGS = d.DomesticCOGS, ItemDomesticRetail = d.DomesticRetail, ItemDomesticSale = d.DomesticSale, ItemDomesticWholeSale = d.DomesticWholesale, ItemInternationalCOGS = 0, ItemInternationalRetail = 0, ItemInternationalSale = 0, ItemInternationalWholeSale = 0, ItemId = d.ItemId, ItemName = d.ItemName, ItemSize = d.Size, Quantity = d.Quantity, Reference = CodeTransferOut, Remark = d.Remark, StorageCode = i.SourceCode, StorageIsCentral = i.SourceName.Contains("GUDANG") ? true : false, StorageId = i.SourceId, StorageName = i.DestinationName, Type = "OUT" }; inven.Quantity = inven.Quantity - d.SendQuantity; TransferOutDocItem transferItem = new TransferOutDocItem { ArticleRealizationOrder = d.ArticleRealizationOrder, DomesticCOGS = d.DomesticCOGS, DomesticRetail = d.DomesticRetail, DomesticSale = d.DomesticSale, DomesticWholeSale = d.DomesticWholesale, ItemCode = d.ItemCode, ItemId = d.ItemId, ItemName = d.ItemName, Quantity = d.Quantity, Remark = d.Remark, Size = d.Size, Uom = d.Uom }; EntityExtension.FlagForCreate(transferItem, username, USER_AGENT); transferOutDocItems.Add(transferItem); //transferOutDoc.Items.Add(transferItem); //transferOutDoc.Items.Add(new TransferOutDocItem //{ // ArticleRealizationOrder = d.ArticleRealizationOrder // DomesticCOGS = d.DomesticCOGS, // DomesticRetail = d.DomesticRetail, // DomesticSale = d.DomesticSale, // DomesticWholeSale = d.DomesticWholesale, // ItemCode = d.ItemCode, // ItemId = d.ItemId, // ItemName = d.ItemName, // Quantity = d.Quantity, // Remark = d.Remark, // Size = d.Size, // Uom = d.Uom //}); EntityExtension.FlagForCreate(d, username, USER_AGENT); EntityExtension.FlagForCreate(movement, username, USER_AGENT); this.dbSetInventoryMovement.Add(movement); } transferOutDoc.Items = transferOutDocItems; EntityExtension.FlagForCreate(i, username, USER_AGENT); EntityExtension.FlagForCreate(transferOutDoc, username, USER_AGENT); this.dbSetTransfer.Add(transferOutDoc); } model.Weight = totalweight; model.Remark = ""; EntityExtension.FlagForCreate(model, username, USER_AGENT); dbSet.Add(model); Created = await dbContext.SaveChangesAsync(); transaction.Commit(); } catch (Exception e) { transaction.Rollback(); throw new Exception(e.Message); } } return(Created); }
/// <summary> /// Loading constructor /// </summary> public FlyingExpedition(int i_id, Expedition e) : base(i_id) { expedition = e; }
public void Load() { _expeditions = new Dictionary <uint, Expedition>(); var contents = FileManager.GetFileContents($"{FileManager.AppPath}Data/expedition.json"); if (string.IsNullOrWhiteSpace(contents)) { throw new IOException($"File {FileManager.AppPath}Data/expedition.json doesn't exists or is empty."); } if (!JsonHelper.TryDeserializeObject(contents, out _config, out _)) // TODO here can out Exception { throw new Exception( $"ExpeditionManager: Parse {FileManager.AppPath}Data/expedition.json file"); } _nameRegex = new Regex(_config.NameRegex, RegexOptions.Compiled); using (var connection = MySQL.CreateConnection()) { using (var command = connection.CreateCommand()) { command.CommandText = "SELECT * FROM expeditions"; command.Prepare(); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var expedition = new Expedition(); expedition.Id = reader.GetUInt32("id"); expedition.MotherId = reader.GetUInt32("mother"); expedition.Name = reader.GetString("name"); expedition.OwnerId = reader.GetUInt32("owner"); expedition.OwnerName = reader.GetString("owner_name"); expedition.UnitOwnerType = 0; expedition.PoliticalSystem = 1; expedition.Created = reader.GetDateTime("created_at"); expedition.AggroLink = false; expedition.DiplomacyTarget = false; _expeditions.Add(expedition.Id, expedition); } } } foreach (var expedition in _expeditions.Values) { using (var command = connection.CreateCommand()) { command.CommandText = "SELECT * FROM expedition_members WHERE expedition_id = @expedition_id"; command.Prepare(); command.Parameters.AddWithValue("@expedition_id", expedition.Id); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var member = new ExpeditionMember(); member.CharacterId = reader.GetUInt32("character_id"); member.ExpeditionId = reader.GetUInt32("expedition_id"); member.Role = reader.GetByte("role"); member.Memo = reader.GetString("memo"); member.LastWorldLeaveTime = reader.GetDateTime("last_leave_time"); member.Name = reader.GetString("name"); member.Level = reader.GetByte("level"); member.Abilities = new byte[] { reader.GetByte("ability1"), reader.GetByte("ability2"), reader.GetByte("ability3") }; member.IsOnline = false; member.InParty = false; expedition.Members.Add(member); } } } using (var command = connection.CreateCommand()) { command.CommandText = "SELECT * FROM expedition_role_policies WHERE expedition_id = @expedition_id"; command.Prepare(); command.Parameters.AddWithValue("@expedition_id", expedition.Id); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var policy = new ExpeditionRolePolicy(); policy.Id = reader.GetUInt32("expedition_id"); policy.Role = reader.GetByte("role"); policy.Name = reader.GetString("name"); policy.DominionDeclare = reader.GetBoolean("dominion_declare"); policy.Invite = reader.GetBoolean("invite"); policy.Expel = reader.GetBoolean("expel"); policy.Promote = reader.GetBoolean("promote"); policy.Dismiss = reader.GetBoolean("dismiss"); policy.Chat = reader.GetBoolean("chat"); policy.ManagerChat = reader.GetBoolean("manager_chat"); policy.SiegeMaster = reader.GetBoolean("siege_master"); policy.JoinSiege = reader.GetBoolean("join_siege"); expedition.Policies.Add(policy); } } } } } }
private void ChangeMode(InfoMode nmode) { if (mode != nmode) { //prev mode switch (mode) { case InfoMode.Expeditions: showingExpedition = null; expeditionButtonImage.overrideSprite = null; break; case InfoMode.Crews: showingCrew = null; crewButtonImage.overrideSprite = null; break; case InfoMode.Artifacts: showingArtifact = null; artifactButtonImage.overrideSprite = null; break; } mode = nmode; if (activeObserver != null) { activeObserver.SetActive(false); } selectedItem = -1; switch (mode) { case InfoMode.Crews: { PrepareCrewsList(); crewButtonImage.overrideSprite = PoolMaster.gui_overridingSprite; if (Crew.crewsList.Count != 0) { var ert = emptyPanel.GetComponent <RectTransform>(); var r = new Rect(ert.position, ert.rect.size); SelectItem(0); } else { if (activeObserver != null) { activeObserver.SetActive(false); activeObserver = null; } emptyPanel.transform.GetChild(0).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.NoCrews); emptyPanel.SetActive(true); } lastDrawnActionHash = Crew.listChangesMarkerValue; break; } case InfoMode.Artifacts: { PrepareArtifactsList(); artifactButtonImage.overrideSprite = PoolMaster.gui_overridingSprite; if (Artifact.artifactsList.Count != 0) { var ert = emptyPanel.GetComponent <RectTransform>(); var r = new Rect(ert.position, ert.rect.size); SelectItem(0); } else { if (activeObserver != null) { activeObserver.SetActive(false); activeObserver = null; } emptyPanel.transform.GetChild(0).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.NoArtifacts); emptyPanel.SetActive(true); } lastDrawnActionHash = Artifact.listChangesMarkerValue; break; } case InfoMode.Expeditions: { PrepareExpeditionsList(); expeditionButtonImage.overrideSprite = PoolMaster.gui_overridingSprite; if (Expedition.expeditionsList.Count != 0) { var ert = emptyPanel.GetComponent <RectTransform>(); SelectItem(0); } else { if (activeObserver != null) { activeObserver.SetActive(false); activeObserver = null; } emptyPanel.transform.GetChild(0).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.NoExpeditions); emptyPanel.SetActive(true); } lastDrawnActionHash = Expedition.listChangesMarker; break; } case InfoMode.Inactive: lastDrawnActionHash = -1; break; } } }
public async Task <int> Create(TransferOutDocViewModel model, TransferOutDoc model2, string username, int clientTimeZoneOffset = 7) { int Created = 0; using (var transaction = this.dbContext.Database.BeginTransaction()) { try { string codeOut = GenerateCode("EFR-KB/RTT"); string packingList1 = GenerateCode("EFR-KB/PLR"); string CodeIn = GenerateCode("EFR-TB/BRT"); string packingList2 = GenerateCode("EFR-KB/PLB"); string expCode = GenerateCode("EFR-KB/EXP"); string codetransferin = GenerateCode("EFR-TB/BRT"); model2.Code = codeOut; model2.Date = DateTimeOffset.Now; var storages = GetStorage("GDG.05"); var expeditionService = GetExpedition("Dikirim Sendiri"); List <ExpeditionItem> expeditionItems = new List <ExpeditionItem>(); List <ExpeditionDetail> expeditionDetails = new List <ExpeditionDetail>(); List <SPKDocsItem> sPKDocsItem1 = new List <SPKDocsItem>(); List <SPKDocsItem> sPKDocsItem2 = new List <SPKDocsItem>(); List <TransferInDocItem> transferInDocs = new List <TransferInDocItem>(); List <InventoryMovement> inventoryMovements = new List <InventoryMovement>(); List <TransferOutDocItem> transferOutDocItems = new List <TransferOutDocItem>(); EntityExtension.FlagForCreate(model2, username, USER_AGENT); foreach (var i in model2.Items) { var invenInTransfer = dbContext.Inventories.Where(x => x.ItemId == i.ItemId && x.StorageId == storages.Id).FirstOrDefault(); if (invenInTransfer == null) { Inventory inventory = new Inventory { ItemArticleRealizationOrder = i.ArticleRealizationOrder, ItemCode = i.ItemCode, ItemDomesticCOGS = i.DomesticCOGS, ItemDomesticRetail = i.DomesticRetail, ItemDomesticSale = i.DomesticSale, ItemDomesticWholeSale = i.DomesticWholeSale, ItemId = i.ItemId, ItemInternationalCOGS = 0, ItemInternationalRetail = 0, ItemInternationalSale = 0, ItemInternationalWholeSale = 0, ItemName = i.ItemName, ItemSize = i.Size, ItemUom = i.Uom, Quantity = 0, StorageCode = storages.Code, StorageId = storages.Id, StorageName = storages.Name, StorageIsCentral = storages.Name.Contains("GUDANG") ? true : false, }; EntityExtension.FlagForCreate(inventory, username, USER_AGENT); dbSetInventory.Add(inventory); transferOutDocItems.Add(new TransferOutDocItem { ArticleRealizationOrder = i.ArticleRealizationOrder, DomesticCOGS = i.DomesticCOGS, DomesticRetail = i.DomesticRetail, DomesticSale = i.DomesticSale, DomesticWholeSale = i.DomesticWholeSale, ItemCode = i.ItemCode, ItemId = i.ItemId, ItemName = i.ItemName, Quantity = i.Quantity, Remark = i.Remark, Size = i.Size, Uom = i.Uom }); } else { invenInTransfer.Quantity = invenInTransfer.Quantity - i.Quantity; } sPKDocsItem1.Add(new SPKDocsItem { ItemArticleRealizationOrder = i.ArticleRealizationOrder, ItemCode = i.ItemCode, ItemDomesticCOGS = i.DomesticCOGS, ItemDomesticRetail = i.DomesticRetail, ItemDomesticSale = i.DomesticSale, ItemDomesticWholesale = i.DomesticWholeSale, ItemId = i.ItemId, ItemName = i.ItemName, ItemSize = i.Size, ItemUom = i.Uom, Quantity = i.Quantity, Remark = i.Remark, SendQuantity = i.Quantity }); sPKDocsItem2.Add(new SPKDocsItem { ItemArticleRealizationOrder = i.ArticleRealizationOrder, ItemCode = i.ItemCode, ItemDomesticCOGS = i.DomesticCOGS, ItemDomesticRetail = i.DomesticRetail, ItemDomesticSale = i.DomesticSale, ItemDomesticWholesale = i.DomesticWholeSale, ItemId = i.ItemId, ItemName = i.ItemName, ItemSize = i.Size, ItemUom = i.Uom, Quantity = i.Quantity, Remark = i.Remark, SendQuantity = i.Quantity }); EntityExtension.FlagForCreate(i, username, USER_AGENT); } EntityExtension.FlagForCreate(model2, username, USER_AGENT); foreach (var i in model2.Items) { //var inventorymovement = new InventoryMovement(); transferInDocs.Add(new TransferInDocItem { ArticleRealizationOrder = i.ArticleRealizationOrder, ItemCode = i.ItemCode, DomesticCOGS = i.DomesticCOGS, DomesticRetail = i.DomesticRetail, DomesticSale = i.DomesticSale, DomesticWholeSale = i.DomesticWholeSale, ItemId = i.ItemId, ItemName = i.ItemName, Size = i.Size, Uom = i.Uom, Quantity = i.Quantity, Remark = i.Remark }); } SPKDocs sPKDocs1 = new SPKDocs { Code = GenerateCode("EFR-PK/PBJ"), Date = DateTimeOffset.Now, SourceId = model2.SourceId, SourceCode = model2.SourceCode, SourceName = model2.SourceName, DestinationId = storages.Id, DestinationCode = storages.Code, DestinationName = storages.Name, IsDistributed = true, IsReceived = true, IsDraft = false, PackingList = packingList1, Reference = codeOut, Password = String.Join("", GenerateCode(DateTime.Now.ToString("dd")).Split("/")), Weight = 0, Items = sPKDocsItem1 }; EntityExtension.FlagForCreate(sPKDocs1, username, USER_AGENT); TransferInDoc transferInDoc = new TransferInDoc { Code = codetransferin, Date = DateTimeOffset.Now, DestinationId = storages.Id, DestinationCode = storages.Code, DestinationName = storages.Name, SourceCode = model2.SourceCode, SourceId = model2.SourceId, SourceName = model2.SourceName, Reference = packingList1, Remark = "", Items = transferInDocs }; EntityExtension.FlagForCreate(transferInDoc, username, USER_AGENT); SPKDocs sPKDocs2 = new SPKDocs { Code = GenerateCode("EFR-PK/PBJ"), Date = DateTimeOffset.Now, DestinationId = model2.DestinationId, DestinationCode = model2.DestinationCode, DestinationName = model2.DestinationName, SourceId = storages.Id, SourceCode = storages.Code, SourceName = storages.Name, IsDistributed = true, IsReceived = false, IsDraft = false, PackingList = packingList2, Reference = codeOut, Password = String.Join("", GenerateCode(DateTime.Now.ToString("dd")).Split("/")), Weight = 0, Items = sPKDocsItem2 }; EntityExtension.FlagForCreate(sPKDocs2, username, USER_AGENT); foreach (var i in sPKDocs1.Items) { var QtySource = 0.0; var invenOutSource = dbContext.Inventories.Where(x => x.ItemId == i.ItemId && x.StorageId == model2.SourceId).FirstOrDefault(); if (invenOutSource != null) { QtySource = invenOutSource.Quantity; invenOutSource.Quantity = invenOutSource.Quantity - i.Quantity; } inventoryMovements.Add(new InventoryMovement { Before = QtySource, After = invenOutSource.Quantity, Date = DateTimeOffset.Now, ItemCode = i.ItemCode, ItemDomesticCOGS = i.ItemDomesticCOGS, ItemDomesticRetail = i.ItemDomesticRetail, ItemDomesticWholeSale = i.ItemDomesticRetail, ItemDomesticSale = i.ItemDomesticSale, ItemId = i.ItemId, ItemInternationalCOGS = 0, ItemInternationalRetail = 0, ItemInternationalSale = 0, ItemInternationalWholeSale = 0, ItemName = i.ItemName, ItemSize = i.ItemSize, ItemUom = i.ItemUom, Quantity = i.Quantity, StorageCode = model2.SourceCode, StorageId = model2.SourceId, StorageName = model2.SourceName, Type = "OUT", Reference = codeOut, Remark = model2.Remark, StorageIsCentral = model2.SourceName.Contains("GUDANG") ? true : false, }); inventoryMovements.Add(new InventoryMovement { Before = 0, After = 1, Date = DateTimeOffset.Now, ItemCode = i.ItemCode, ItemDomesticCOGS = i.ItemDomesticCOGS, ItemDomesticRetail = i.ItemDomesticRetail, ItemDomesticWholeSale = i.ItemDomesticRetail, ItemDomesticSale = i.ItemDomesticSale, ItemId = i.ItemId, ItemInternationalCOGS = 0, ItemInternationalRetail = 0, ItemInternationalSale = 0, ItemInternationalWholeSale = 0, ItemName = i.ItemName, ItemSize = i.ItemSize, ItemUom = i.ItemUom, Quantity = i.Quantity, StorageCode = storages.Code, StorageId = storages.Id, StorageName = storages.Name, Type = "IN", Reference = codetransferin, Remark = model2.Remark, StorageIsCentral = storages.Name.Contains("GUDANG") ? true : false, }); inventoryMovements.Add(new InventoryMovement { Before = 1, After = 0, Date = DateTimeOffset.Now, ItemCode = i.ItemCode, ItemDomesticCOGS = i.ItemDomesticCOGS, ItemDomesticRetail = i.ItemDomesticRetail, ItemDomesticWholeSale = i.ItemDomesticRetail, ItemDomesticSale = i.ItemDomesticSale, ItemId = i.ItemId, ItemInternationalCOGS = 0, ItemInternationalRetail = 0, ItemInternationalSale = 0, ItemInternationalWholeSale = 0, ItemName = i.ItemName, ItemSize = i.ItemSize, ItemUom = i.ItemUom, Quantity = i.Quantity, StorageCode = model2.DestinationCode, StorageId = model2.DestinationId, StorageName = model2.DestinationName, Type = "OUT", Reference = expCode, Remark = model2.Remark, StorageIsCentral = model2.DestinationName.Contains("GUDANG") ? true : false, }); expeditionDetails.Add(new ExpeditionDetail { ArticleRealizationOrder = i.ItemArticleRealizationOrder, DomesticCOGS = i.ItemDomesticCOGS, DomesticRetail = i.ItemDomesticRetail, DomesticSale = i.ItemDomesticSale, DomesticWholesale = i.ItemDomesticWholesale, ItemCode = i.ItemCode, ItemId = i.ItemId, ItemName = i.ItemName, Quantity = i.Quantity, Remark = i.Remark, SendQuantity = i.SendQuantity, Uom = i.ItemUom, Size = i.ItemSize, //SPKDocsId = (int)dbContext.SPKDocs.OrderByDescending(x=>x.Id).FirstOrDefault().Id + 1 SPKDocsId = (int)sPKDocs1.Id }); EntityExtension.FlagForCreate(i, username, USER_AGENT); } expeditionItems.Add(new ExpeditionItem { Code = sPKDocs2.Code, Date = sPKDocs2.Date, DestinationCode = sPKDocs2.DestinationCode, DestinationId = (int)sPKDocs2.DestinationId, DestinationName = sPKDocs2.DestinationName, IsDistributed = sPKDocs2.IsDistributed, IsDraft = sPKDocs2.IsDraft, IsReceived = sPKDocs2.IsReceived, PackingList = sPKDocs2.PackingList, Password = sPKDocs2.Password, Reference = codeOut, SourceCode = sPKDocs2.SourceCode, SourceId = (int)sPKDocs2.SourceId, SourceName = sPKDocs2.SourceName, //SPKDocsId = (int)dbContext.SPKDocs.OrderByDescending(x => x.Id).FirstOrDefault().Id + 1, SPKDocsId = (int)sPKDocs2.Id, Weight = sPKDocs2.Weight, Details = expeditionDetails }); Expedition expedition = new Expedition { Code = expCode, Date = DateTimeOffset.Now, ExpeditionServiceCode = expeditionService.code, ExpeditionServiceId = (int)expeditionService._id, ExpeditionServiceName = expeditionService.name, Remark = "", Weight = 0, Items = expeditionItems, }; EntityExtension.FlagForCreate(expedition, username, USER_AGENT); TransferOutDoc transferOutDoc2 = new TransferOutDoc { Code = expCode, Date = DateTimeOffset.Now, DestinationCode = model2.DestinationCode, DestinationId = model2.DestinationId, DestinationName = model2.DestinationName, Reference = packingList2, Remark = "", SourceId = storages.Id, SourceCode = storages.Code, SourceName = storages.Name, Items = transferOutDocItems }; EntityExtension.FlagForCreate(transferOutDoc2, username, USER_AGENT); #region Saving foreach (var i in transferOutDoc2.Items) { EntityExtension.FlagForCreate(i, username, USER_AGENT); } foreach (var i in sPKDocs2.Items) { EntityExtension.FlagForCreate(i, username, USER_AGENT); } foreach (var i in expedition.Items) { EntityExtension.FlagForCreate(i, username, USER_AGENT); foreach (var d in i.Details) { EntityExtension.FlagForCreate(d, username, USER_AGENT); } } foreach (var i in transferInDoc.Items) { EntityExtension.FlagForCreate(i, username, USER_AGENT); } foreach (var i in inventoryMovements) { EntityExtension.FlagForCreate(i, username, USER_AGENT); dbSetInventoryMovement.Add(i); } dbSetExpedition.Add(expedition); dbSetSpk.Add(sPKDocs1); dbSetSpk.Add(sPKDocs2); dbSet.Add(model2); dbSet.Add(transferOutDoc2); dbSetTransferIn.Add(transferInDoc); Created = await dbContext.SaveChangesAsync(); transaction.Commit(); #endregion } catch (Exception e) { transaction.Rollback(); throw new Exception(e.Message); } return(Created); } }
public void ExpeditionEnteredLocation(Expedition e) { expeditionsOnLocation.Add(e); }
public static Expedition operator /(Velocity s, Duration t) => Expedition.FromMetersPerSquareSecond(s.MeterPerSecond / t.Second);
public ExpeditionViewModel(Expedition expedition) { this.source = expedition; this.CompositeDisposable.Add(new PropertyChangedEventListener(expedition, (sender, args) => this.RaisePropertyChanged(args.PropertyName))); }
public ExpeditionWrapper(int id, Expedition expedition) { this.Id = id; this.Source = expedition; this.Source.Subscribe(nameof(Expedition.Remaining), () => this.UpdateState()).AddTo(this); }
public void ResolveExpedition(Location l, Expedition e) { l.ExpeditionLeftLocation(e); App.View.locationView.LocationUpdated(l); SpawnNewExpedition(); }
public async Task <ActionResult> IndexAsync() { Expedition exp = await _expeditionRepository.GetCurrent(); return(View(exp)); }
public bool SaveGame(string name) { // заменить потом на persistent - постоянный путь SetPause(true); string path = SaveSystemUI.GetSavesPath() + '/'; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } Stream fs = File.Create(path + name + '.' + SaveSystemUI.SAVE_FNAME_EXTENSION); currentSavename = name; //сразу передавать файловый поток для записи, чтобы не забивать озу #region gms mainPartFilling fs.Write(System.BitConverter.GetBytes(GameConstants.SAVE_SYSTEM_VERSION), 0, 4); fs.WriteByte((byte)gameMode); // start writing fs.Write(System.BitConverter.GetBytes(gameSpeed), 0, 4); fs.Write(System.BitConverter.GetBytes(lifeGrowCoefficient), 0, 4); fs.Write(System.BitConverter.GetBytes(demolitionLossesPercent), 0, 4); fs.Write(System.BitConverter.GetBytes(lifepowerLossesPercent), 0, 4); fs.Write(System.BitConverter.GetBytes(LUCK_COEFFICIENT), 0, 4); fs.Write(System.BitConverter.GetBytes(sellPriceCoefficient), 0, 4); fs.Write(System.BitConverter.GetBytes(tradeVesselsTrafficCoefficient), 0, 4); fs.Write(System.BitConverter.GetBytes(upgradeDiscount), 0, 4); fs.Write(System.BitConverter.GetBytes(upgradeCostIncrease), 0, 4); fs.Write(System.BitConverter.GetBytes(warProximity), 0, 4); //40 fs.WriteByte((byte)difficulty); // 41 fs.WriteByte(prevCutHeight); //42 fs.WriteByte(day); // 43 fs.WriteByte(month); //44 fs.Write(System.BitConverter.GetBytes(year), 0, 4); fs.Write(System.BitConverter.GetBytes(timeGone), 0, 4); fs.Write(System.BitConverter.GetBytes(gearsDegradeSpeed), 0, 4); fs.Write(System.BitConverter.GetBytes(labourTimer), 0, 4); fs.Write(System.BitConverter.GetBytes(RecruitingCenter.GetHireCost()), 0, 4); fs.Write(System.BitConverter.GetBytes(gameID), 0, 4); //68 (+4) end #endregion DockSystem.SaveDockSystem(fs); if (globalMap != null) { fs.WriteByte(1); globalMap.Save(fs); } else { fs.WriteByte(0); } environmentMaster.Save(fs); Artifact.SaveStaticData(fs); Crew.SaveStaticData(fs); mainChunk.SaveChunkData(fs); colonyController.Save(fs); // <------- COLONY CONTROLLER QuestUI.current.Save(fs); Expedition.SaveStaticData(fs); Knowledge.GetCurrent().Save(fs); if (executingScenario != null) { fs.WriteByte(1); executingScenario.Save(fs); } else { fs.WriteByte(0); } FollowingCamera.main.Save(fs); fs.Position = 0; double hashsum = GetHashSum(fs, false); fs.Write(System.BitConverter.GetBytes(hashsum), 0, 8); fs.Close(); SetPause(false); return(true); }
public bool LoadGame(string fullname) { bool debug_noresource = weNeedNoResources; FileStream fs = File.Open(fullname, FileMode.Open); double realHashSum = GetHashSum(fs, true); var data = new byte[8]; fs.Read(data, 0, 8); double readedHashSum = System.BitConverter.ToDouble(data, 0); string errorReason = "reason not stated"; if (realHashSum == readedHashSum) { fs.Position = 0; SetPause(true); loading = true; // ОЧИСТКА StopAllCoroutines(); if (Zeppelin.current != null) { Destroy(Zeppelin.current); } if (mainChunk != null) { mainChunk.ClearChunk(); } // очистка подписчиков на ивенты невозможна, сами ивенты к этому моменту недоступны Crew.Reset(); Expedition.GameReset(); Structure.ResetToDefaults_Static(); // все наследуемые resetToDefaults внутри if (colonyController != null) { colonyController.ResetToDefaults(); // подчищает все списки } else { colonyController = gameObject.AddComponent <ColonyController>(); colonyController.Prepare(); } //UI.current.Reset(); // НАЧАЛО ЗАГРУЗКИ if (gameStarted) { SetDefaultValues(); } #region gms mainPartLoading data = new byte[4]; fs.Read(data, 0, 4); uint saveSystemVersion = System.BitConverter.ToUInt32(data, 0); // может пригодиться в дальнейшем //start writing data = new byte[65]; fs.Read(data, 0, data.Length); gameSpeed = System.BitConverter.ToSingle(data, 0); lifeGrowCoefficient = System.BitConverter.ToSingle(data, 4); demolitionLossesPercent = System.BitConverter.ToSingle(data, 8); lifepowerLossesPercent = System.BitConverter.ToSingle(data, 12); LUCK_COEFFICIENT = System.BitConverter.ToSingle(data, 16); sellPriceCoefficient = System.BitConverter.ToSingle(data, 20); tradeVesselsTrafficCoefficient = System.BitConverter.ToSingle(data, 24); upgradeDiscount = System.BitConverter.ToSingle(data, 28); upgradeCostIncrease = System.BitConverter.ToSingle(data, 32); warProximity = System.BitConverter.ToSingle(data, 36); difficulty = (Difficulty)data[40]; startGameWith = (GameStart)data[41]; prevCutHeight = data[42]; day = data[43]; month = data[44]; year = System.BitConverter.ToUInt32(data, 45); timeGone = System.BitConverter.ToSingle(data, 49); gearsDegradeSpeed = System.BitConverter.ToSingle(data, 53); labourTimer = System.BitConverter.ToSingle(data, 57); RecruitingCenter.SetHireCost(System.BitConverter.ToSingle(data, 61)); #endregion DockSystem.LoadDockSystem(fs); globalMap.Load(fs); if (loadingFailed) { errorReason = "global map error"; goto FAIL; } environmentMaster.Load(fs); if (loadingFailed) { errorReason = "environment error"; goto FAIL; } Artifact.LoadStaticData(fs); // crews & monuments if (loadingFailed) { errorReason = "artifacts load failure"; goto FAIL; } Crew.LoadStaticData(fs); if (loadingFailed) { errorReason = "crews load failure"; goto FAIL; } if (mainChunk == null) { GameObject g = new GameObject("chunk"); mainChunk = g.AddComponent <Chunk>(); } mainChunk.LoadChunkData(fs); if (loadingFailed) { errorReason = "chunk load failure"; goto FAIL; } else { if (blockersRestoreEvent != null) { blockersRestoreEvent(); } } Settlement.TotalRecalculation(); // Totaru Annihirationu no imoto-chan if (loadingFailed) { errorReason = "settlements load failure"; goto FAIL; } colonyController.Load(fs); // < --- COLONY CONTROLLER if (loadingFailed) { errorReason = "colony controller load failure"; goto FAIL; } if (loadingFailed) { errorReason = "dock load failure"; goto FAIL; } QuestUI.current.Load(fs); if (loadingFailed) { errorReason = "quest load failure"; goto FAIL; } Expedition.LoadStaticData(fs); Knowledge.Load(fs); fs.Close(); FollowingCamera.main.WeNeedUpdate(); loading = false; savename = fullname; if (afterloadRecalculationEvent != null) { afterloadRecalculationEvent(); afterloadRecalculationEvent = null; } SetPause(false); colonyController.FORCED_PowerGridRecalculation(); return(true); } else { GameLogUI.MakeImportantAnnounce(Localization.GetAnnouncementString(GameAnnouncements.LoadingFailed) + " : hashsum incorrect"); if (soundEnabled) { audiomaster.Notify(NotificationSound.SystemError); } SetPause(true); fs.Close(); return(false); } FAIL: GameLogUI.MakeImportantAnnounce(Localization.GetAnnouncementString(GameAnnouncements.LoadingFailed) + " : data corruption"); if (soundEnabled) { audiomaster.Notify(NotificationSound.SystemError); } print(errorReason); SetPause(true); fs.Close(); if (debug_noresource) { weNeedNoResources = true; } return(false); }
public void SelectItem(int i) { if (selectedItem != i) { if (selectedItem != -1) { items[selectedItem].GetComponent <Image>().overrideSprite = null; } selectedItem = i; items[selectedItem].GetComponent <Image>().overrideSprite = PoolMaster.gui_overridingSprite; } var realIndex = i + GetListStartIndex(); switch (mode) { case InfoMode.Expeditions: { if (realIndex >= Expedition.expeditionsList.Count) { PrepareExpeditionsList(); } else { var e = Expedition.expeditionsList[realIndex]; var ert = emptyPanel.GetComponent <RectTransform>(); e.ShowOnGUI(new Rect(ert.position, ert.rect.size), SpriteAlignment.TopLeft, true); activeObserver = Expedition.GetObserver().gameObject; if (emptyPanel.activeSelf) { emptyPanel.SetActive(false); } } break; } case InfoMode.Crews: { if (realIndex >= Crew.crewsList.Count) { PrepareCrewsList(); } else { var e = Crew.crewsList[realIndex]; var ert = emptyPanel.GetComponent <RectTransform>(); var r = new Rect(ert.position, ert.rect.size); e.ShowOnGUI(r, SpriteAlignment.TopLeft, false); activeObserver = Crew.crewObserver.gameObject; if (emptyPanel.activeSelf) { emptyPanel.SetActive(false); } } break; } case InfoMode.Artifacts: if (realIndex >= Artifact.artifactsList.Count) { PrepareArtifactsList(); } else { var e = Artifact.artifactsList[realIndex]; var ert = emptyPanel.GetComponent <RectTransform>(); var r = new Rect(ert.position, ert.rect.size); e.ShowOnGUI(r, SpriteAlignment.TopLeft, false); activeObserver = Artifact.observer.gameObject; if (emptyPanel.activeSelf) { emptyPanel.SetActive(false); } } break; } if (activeObserver != null) { activeObserver.transform.SetAsLastSibling(); } }
// private void ChangeMode(InfoMode nmode) { if (mode != nmode) { //prev mode switch (mode) { case InfoMode.Expeditions: selectedExpedition = null; expeditionButtonImage.overrideSprite = null; break; case InfoMode.Crews: selectedCrew = null; crewButtonImage.overrideSprite = null; break; case InfoMode.Artifacts: selectedArtifact = null; artifactButtonImage.overrideSprite = null; break; } mode = nmode; if (activeObserver != null) activeObserver.SetActive(false); switch (mode) { case InfoMode.Crews: { listController.PrepareList(crewsData); crewButtonImage.overrideSprite = PoolMaster.gui_overridingSprite; if (Crew.crewsList.Count != 0) { if (selectedCrew == null) SelectItem(0); } else { if (activeObserver != null) { activeObserver.SetActive(false); activeObserver = null; } listController.ChangeEmptyLabelText(Localization.GetPhrase(LocalizedPhrase.NoCrews)); } lastDrawnActionHash = Crew.listChangesMarkerValue; if (!listController.isActiveAndEnabled) listController.gameObject.SetActive(true); break; } case InfoMode.Artifacts: { listController.PrepareList(artifactsData); artifactButtonImage.overrideSprite = PoolMaster.gui_overridingSprite; if (Artifact.artifactsList.Count != 0) { if (selectedArtifact == null) SelectItem(0); } else { if (activeObserver != null) { activeObserver.SetActive(false); activeObserver = null; } listController.ChangeEmptyLabelText(Localization.GetPhrase(LocalizedPhrase.NoArtifacts)); } lastDrawnActionHash = Artifact.listChangesMarkerValue; if (!listController.isActiveAndEnabled) listController.gameObject.SetActive(true); break; } case InfoMode.Expeditions: { listController.PrepareList(expeditionsData); expeditionButtonImage.overrideSprite = PoolMaster.gui_overridingSprite; if (Expedition.expeditionsList.Count != 0) { if (selectedExpedition == null) SelectItem(0); } else { if (activeObserver != null) { activeObserver.SetActive(false); activeObserver = null; } listController.ChangeEmptyLabelText(Localization.GetPhrase(LocalizedPhrase.NoExpeditions)); } lastDrawnActionHash = Expedition.listChangesMarker; if (!listController.isActiveAndEnabled) listController.gameObject.SetActive(true); break; } case InfoMode.Inactive: if (listController.isActiveAndEnabled) listController.gameObject.SetActive(false); lastDrawnActionHash = -1; break; } } }
public async Task <int> Create(TransferOutDocViewModel model, TransferOutDoc model2, string username, int clientTimeZoneOffset = 7) { int Created = 0; using (var transaction = this.dbContext.Database.BeginTransaction()) { try { string codeOut = GenerateCode("EFR-KB/RTP"); model2.Code = codeOut; model2.Date = DateTimeOffset.Now; List <ExpeditionItem> expeditionItems = new List <ExpeditionItem>(); List <ExpeditionDetail> expeditionDetails = new List <ExpeditionDetail>(); List <SPKDocsItem> sPKDocsItem = new List <SPKDocsItem>(); EntityExtension.FlagForCreate(model2, username, USER_AGENT); foreach (var i in model2.Items) { sPKDocsItem.Add(new SPKDocsItem { ItemArticleRealizationOrder = i.ArticleRealizationOrder, ItemCode = i.ItemCode, ItemDomesticCOGS = i.DomesticCOGS, ItemDomesticRetail = i.DomesticRetail, ItemDomesticSale = i.DomesticSale, ItemDomesticWholesale = i.DomesticWholeSale, ItemId = i.ItemId, ItemName = i.ItemName, ItemSize = i.Size, ItemUom = i.Uom, Quantity = i.Quantity, Remark = i.Remark, SendQuantity = i.Quantity }); EntityExtension.FlagForCreate(i, username, USER_AGENT); } dbSet.Add(model2); //Created = await dbContext.SaveChangesAsync(); SPKDocs sPKDocs = new SPKDocs { Code = GenerateCode("EFR-PK/PBJ"), Date = DateTimeOffset.Now, IsDistributed = true, IsDraft = false, IsReceived = false, DestinationCode = model2.DestinationCode, DestinationId = model2.DestinationId, DestinationName = model2.DestinationName, PackingList = GenerateCode("EFR-KB/PLR"), Password = String.Join("", GenerateCode(DateTime.Now.ToString("dd")).Split("/")), Reference = codeOut, SourceCode = model2.SourceCode, SourceName = model2.SourceName, SourceId = model2.SourceId, Weight = 0, Items = sPKDocsItem }; EntityExtension.FlagForCreate(sPKDocs, username, USER_AGENT); foreach (var i in sPKDocs.Items) { var inventorymovement = new InventoryMovement(); var inven = dbContext.Inventories.Where(x => x.ItemId == i.ItemId && x.StorageId == model2.SourceId).FirstOrDefault(); if (inven != null) { inventorymovement.Before = inven.Quantity; inven.Quantity = inven.Quantity - i.Quantity; } inventorymovement.After = inventorymovement.Before + i.Quantity; inventorymovement.Date = DateTimeOffset.UtcNow; inventorymovement.ItemCode = i.ItemCode; inventorymovement.ItemDomesticCOGS = i.ItemDomesticCOGS; inventorymovement.ItemDomesticRetail = i.ItemDomesticRetail; inventorymovement.ItemDomesticWholeSale = i.ItemDomesticRetail; inventorymovement.ItemDomesticSale = i.ItemDomesticSale; inventorymovement.ItemId = i.ItemId; inventorymovement.ItemInternationalCOGS = 0; inventorymovement.ItemInternationalRetail = 0; inventorymovement.ItemInternationalSale = 0; inventorymovement.ItemInternationalWholeSale = 0; inventorymovement.ItemName = i.ItemName; inventorymovement.ItemSize = i.ItemSize; inventorymovement.ItemUom = i.ItemUom; inventorymovement.Quantity = i.Quantity; inventorymovement.StorageCode = model2.SourceCode; inventorymovement.StorageId = model2.SourceId; inventorymovement.StorageName = model2.SourceName; inventorymovement.Type = "OUT"; inventorymovement.Reference = codeOut; inventorymovement.Remark = model2.Remark; inventorymovement.StorageIsCentral = model2.SourceName.Contains("GUDANG") ? true : false; EntityExtension.FlagForCreate(inventorymovement, username, USER_AGENT); dbSetInventoryMovement.Add(inventorymovement); EntityExtension.FlagForCreate(i, username, USER_AGENT); } dbSetSPKDocs.Add(sPKDocs); Created = await dbContext.SaveChangesAsync(); foreach (var i in sPKDocs.Items) { expeditionDetails.Add(new ExpeditionDetail { ArticleRealizationOrder = i.ItemArticleRealizationOrder, DomesticCOGS = i.ItemDomesticCOGS, DomesticRetail = i.ItemDomesticRetail, DomesticSale = i.ItemDomesticSale, DomesticWholesale = i.ItemDomesticWholesale, ItemCode = i.ItemCode, ItemId = i.ItemId, ItemName = i.ItemName, Quantity = i.Quantity, Remark = i.Remark, SendQuantity = i.SendQuantity, Uom = i.ItemUom, Size = i.ItemSize, //SPKDocsId = (int)dbContext.SPKDocs.OrderByDescending(x => x.Id).FirstOrDefault().Id + 1 SPKDocsId = (int)sPKDocs.Id }); } expeditionItems.Add(new ExpeditionItem { Code = sPKDocs.Code, Date = sPKDocs.Date, DestinationCode = sPKDocs.DestinationCode, DestinationId = (int)sPKDocs.DestinationId, DestinationName = sPKDocs.DestinationName, IsDistributed = sPKDocs.IsDistributed, IsDraft = sPKDocs.IsDraft, IsReceived = sPKDocs.IsReceived, PackingList = sPKDocs.PackingList, Password = sPKDocs.Password, Reference = sPKDocs.Reference, SourceCode = sPKDocs.SourceCode, SourceId = (int)sPKDocs.SourceId, SourceName = sPKDocs.SourceName, //SPKDocsId = (int)dbContext.SPKDocs.OrderByDescending(x => x.Id).FirstOrDefault().Id + 1, SPKDocsId = (int)sPKDocs.Id, Weight = sPKDocs.Weight, Details = expeditionDetails }); Expedition expedition = new Expedition { Code = GenerateCode("EFR-KB/EXP"), Date = DateTimeOffset.Now, ExpeditionServiceCode = model.expeditionService.code, ExpeditionServiceId = (int)model.expeditionService._id, ExpeditionServiceName = model.expeditionService.name, Remark = "", Weight = 0, Items = expeditionItems, }; EntityExtension.FlagForCreate(expedition, username, USER_AGENT); foreach (var i in expeditionItems) { EntityExtension.FlagForCreate(i, username, USER_AGENT); foreach (var d in expeditionDetails) { EntityExtension.FlagForCreate(d, username, USER_AGENT); } } dbSetExpedition.Add(expedition); Created = await dbContext.SaveChangesAsync(); transaction.Commit(); } catch (Exception e) { transaction.Rollback(); throw new Exception(e.Message); } } return(Created); }
public LogFileHandler(Expedition expedition) { _netlogfiles = new Dictionary <string, NetLogFileInfo>(); VisitedSystems = new List <SystemPosition>(); _expedition = expedition; }