public ActionResult Details(Guid id) { BusinessState item = _iBusinessStateService.GetById(id); ViewBag.UserId = _iUserInfo.UserId; return(View(item)); }
public void Enforce(string input) { foreach (var rule in rules) { m_state = rule.EnforceRule(input); } }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "faceWifeNeutral"; EventState.currentEventText = string.Format("{0} comes up to you. She suggests buying a special toy for your son's birthday.", WifeEventChain.NAME); if (GameData.singleton.money >= toyCost) { EventState.currentEventOptions = new string[] { "Give her " + Utilities.FormatMoney(toyCost), "Say you can't afford it" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT, EventStage.REFUSE }; } else { EventState.currentEventOptions = new string[] { "Say you can't afford it" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.REFUSE }; } break; case EventStage.ACCEPT: EventState.currentEventImage = "faceWifeHappy"; EventState.currentEventText = "\"I think this will make him very happy.\" She gives you a quick kiss and leaves the shop."; EventState.PushEvent(new SonEventBirthday(), GameData.singleton.quarter + 1); GameData.singleton.wifeRelationship += 5; BusinessState.MoneyChangeFromEvent(-toyCost); EventState.currentEventOptions = EventState.CONTINUE_OPTION; return(EventResult.DONE); case EventStage.REFUSE: EventState.currentEventImage = "faceWifeSad"; if (GameData.singleton.money <= toyCost * 5) { EventState.currentEventText = "\"That's too bad. I know things are tough right now. He'll understand.\""; } else if (GameData.singleton.money >= toyCost * 10) { EventState.currentEventText = "\"I think we could spare it. How can you neglect our son like that?\" She goes outside."; GameData.singleton.wifeRelationship -= 10; } else { EventState.currentEventText = "\"Okay, I'll see if I can find something else myself...\" She leaves."; } EventState.currentEventOptions = EventState.CONTINUE_OPTION; return(EventResult.DONE); } return(EventResult.CONTINUE); }
// // GET: /Platform/SysDepartment/Edit/5 public ActionResult Edit(Guid?id) { var item = new BusinessState(); if (id.HasValue) { item = _iBusinessStateService.GetById(id.Value); } return(View(item)); }
public ActionResult Edit(Guid?id, BusinessState collection) { if (!ModelState.IsValid) { return(View(collection)); } _iBusinessStateService.Save(id, collection); _unitOfWork.Commit(); return(RedirectToAction("Index")); }
/// <summary> /// 返回特定状态的集合 /// </summary> /// <param name="state">状态</param> /// <returns></returns> public EntityCollection <T> SeekState(BusinessState state) { EntityCollection <T> result = new EntityCollection <T>(); foreach (T obj in this) { if (obj.State == state) { result.Add(obj); } } return(result); }
public void Reset() //Reset to its default state { state = new BusinessState(); state.isOwned = false; state.hasManager = false; state.currentLevel = 0; state.currentUnlock = 0; state.currentRevenue = startingRevenue; state.currentRevenueMultiplier = 0.0f; state.currentInvestCost = startingInvestCost; state.currentInvestMultiplier = 1.0f; state.revenueProgressBarTime = startingTime; state.currentTime = 0.0f; }
//Business stuff public static void SaveBusinessState(BusinessState state, string _name) { string path = Path.Combine(Application.persistentDataPath, "BusinessStates"); DirectoryInfo dir = new DirectoryInfo(path); if (dir.Exists == false) { dir.Create(); } BinaryFormatter bf = new BinaryFormatter(); FileStream stream = File.Create(Path.Combine(path, _name + ".bstate")); bf.Serialize(stream, state); stream.Close(); }
public static BusinessState LoadBusinessState(string _name) { string path = Path.Combine(Application.persistentDataPath, "BusinessStates"); string file = Path.Combine(path, _name + ".bstate"); FileInfo info = new FileInfo(file); if (info.Exists == false) { return(null); } BinaryFormatter bf = new BinaryFormatter(); FileStream stream = File.Open(file, FileMode.Open); BusinessState state = new BusinessState(); state = bf.Deserialize(stream) as BusinessState; stream.Close(); return(state); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "faceOther"; EventState.currentEventText = "A man approaches you at the counter. He looks familiar. \"I'm back from my business venture!\""; EventState.currentEventOptions = new string[] { "Continue" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2 }; break; case EventStage.S2: EventState.currentEventImage = "faceOther"; EventState.currentEventText = string.Format("\"Didn't I tell you you wouldn't regret it?\" He hands you {0}, then goes on his way.", Utilities.FormatMoney(COST)); EventState.currentEventOptions = EventState.OK_OPTION; BusinessState.MoneyChangeFromEvent(COST * 2); return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "facePlayerNeutral"; EventState.currentEventText = "\"Ah, " + NAME + "'s birthday is coming up!\""; if (GameData.singleton.money > COST) { EventState.currentEventOptions = new string[] { string.Format("Buy her a gift (-{0})", Utilities.FormatMoney(COST)), "I don't have any money to spare" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT, EventStage.REFUSE }; } else { EventState.currentEventOptions = new string[] { "I don't have any money to spare" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.REFUSE }; } break; case EventStage.ACCEPT: BusinessState.MoneyChangeFromEvent(-COST); GameData.singleton.wifeRelationship += 11f; EventState.currentEventImage = "facePlayerHappy"; EventState.currentEventText = "\"I know just the thing to get! I hope she likes it.\""; EventState.currentEventOptions = new string[] { "Ok" }; return(EventResult.DONE); case EventStage.REFUSE: GameData.singleton.wifeRelationship -= 1f; EventState.currentEventImage = "facePlayerNeutral"; EventState.currentEventText = "\"Hopefully she doesn't mind.\""; EventState.currentEventOptions = new string[] { "Ok" }; return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventImage = "faceOther"; EventState.currentEventText = "Someone approaches you at the counter. \"I have a proposition for you.\""; EventState.currentEventOptions = new string[] { "Go on..." }; mCurrentOptionOutcomes = new EventStage[] { EventStage.DECIDE }; break; case EventStage.DECIDE: EventState.currentEventImage = "faceOther"; EventState.currentEventText = string.Format("I've got an investment opportunity. Lend me {0}, and I'll pay you back double.", Utilities.FormatMoney(COST)); EventState.currentEventOptions = new string[] { "Accept the deal", "Refuse" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT, EventStage.REFUSE }; break; case EventStage.ACCEPT: EventState.currentEventImage = "faceOther"; EventState.currentEventText = string.Format("\"You won't regret this!\", he says. He takes your {0} and leaves.", Utilities.FormatMoney(COST)); EventState.PushEvent(new InvestmentReturnEvent(), GameData.singleton.quarter + 4); BusinessState.MoneyChangeFromEvent(-COST); EventState.currentEventOptions = EventState.OK_OPTION; return(EventResult.DONE); case EventStage.REFUSE: EventState.currentEventImage = "faceOther"; EventState.currentEventText = "\"Suit yourself...\", he says. He leaves without another word."; EventState.currentEventOptions = EventState.OK_OPTION; return(EventResult.DONE); } return(EventResult.CONTINUE); }
/// <summary> /// 根据其他EntityBase内容重新初始化 /// </summary> /// <param name="entity"></param> public void ReInitialize(EntityBase entity) { this._state = entity.State; this._data = entity.DataCollection; //_tableSchema = entity.OringTableSchema; }
public EntityBase() { _data = new Dictionary <string, object>(); _state = BusinessState.Added; }
// Change text and other fields in UI content private void UpdateUiContent() { GameStage stage = GameData.singleton.currentStage; /** * Inventory */ { // Inventory (cash) InventoryView.transform.Find("InvGroups/InventoryCash/IconAndCount/Count") .GetComponent <Text>().text = string.Format("{0}", GameData.singleton.money); // Inventory (feathers) List <FeatherAndCount> resourceCounts = new List <FeatherAndCount>(); for (int i = 0; i < (int)FeatherType.FT_MAX; i++) { resourceCounts.Add(new FeatherAndCount((FeatherType)i, GameData.singleton.feathersOwned[i])); } mInventoryResourceRenderGroup.UpdateRenderables(resourceCounts); // Inventory (feathers) List <PotionAndCount> productCounts = new List <PotionAndCount>(); for (int i = 0; i < (int)PotionType.PT_MAX; i++) { productCounts.Add(new PotionAndCount((PotionType)i, GameData.singleton.potionsOwned[i])); } mInventoryProductRenderGroup.UpdateRenderables(productCounts); } /** * Summary */ if (SummaryView.activeInHierarchy) { // Per-item reports mItemQuarterlySummaryRenderGroup.UpdateRenderables(BusinessState.GetPerItemReports()); } /** * Peacock view */ if (PeacockView.activeInHierarchy) { mPeacockFeatherRenderGroup.UpdateRenderables(GameData.singleton.peacockReportFeatherCounts); } /** * Simulation / Event */ if (SimulationView.activeInHierarchy) { // Color and show/hide potions in the shop for (int i = 0; i < (int)PotionType.PT_MAX; i++) { var PotionGroup = GetPotionGroup((PotionType)i); for (int j = 0; j < PotionGroup.childCount; j++) { PotionGroup.GetChild(j).gameObject.SetActive(j < GameData.singleton.potionsOwned[i]); PotionGroup.GetChild(j).GetComponent <Image>().color = ((PotionType)i).GetColor(); // TODO: if a potion stopped being visible it was just sold. Show the +money animation there } } SimulationDefaultContent.transform.Find("Shop/Season").GetComponent <Image>().sprite = null; // clear the sprite in case of weird sprite change bug SimulationDefaultContent.transform.Find("Shop/Season").GetComponent <Image>().sprite = SpriteManager.GetSprite(GameData.singleton.season.GetImage()); // Date SimulationView.transform.Find("Overlay/TopLeft/Date/Month/Text").GetComponent <Text>().text = GameData.singleton.month; SimulationView.transform.Find("Overlay/TopLeft/Date/Day/Text").GetComponent <Text>().text = GameData.singleton.dayOfMonth.ToString(); } /** * Overlay views */ int totalPotionRevenue = 0; foreach (BusinessState.PerItemReport report in BusinessState.GetPerItemReports()) { totalPotionRevenue += (report.numSold * report.salePrice); } if (OverlayViewFeathers.activeInHierarchy) { //OverlayViewPotions.transform.Find("Content/Content").GetComponent<Text>().text = ""; mOverlayFeatherCollectionFeatherRenderGroup.UpdateRenderables( GameData.singleton.peacockReportFeatherCounts.FindAll(fc => fc.count > 0)); } else if (OverlayViewPotions.activeInHierarchy) { mOverlayPotionSalesRenderGroup.UpdateRenderables(BusinessState.GetPerItemReports()); OverlayViewPotions.transform.Find("PotionSaleTotal/Row/H/Total").GetComponent <Text>().text = string.Format("${0}", totalPotionRevenue); } else if (OverlayViewFinancial.activeInHierarchy) { int startOfQuarterBalance = GameData.singleton.initialBalance; int eventIncome = GameData.singleton.eventIncome; int peacockExpenses = GameData.singleton.peacockQuarterlyTotalCost; int eventExpense = GameData.singleton.eventExpenses; int profit = (totalPotionRevenue + eventIncome) - (peacockExpenses + eventExpense); int rent = GameData.singleton.livingExpenses; int newBalance = (int)GameData.singleton.money - rent; // totalRevenue = sum of perItemReport sales // include some event revenue and expenses // revenue rent etc List <string[]> financialReportRows = new List <string[]>(); financialReportRows.Add(new string[] { "Beginning Balance", "", string.Format("{0}", startOfQuarterBalance) }); financialReportRows.Add(new string[] { "Potion Sales", string.Format("+{0}", totalPotionRevenue), "" }); financialReportRows.Add(new string[] { "Peacock Care", string.Format("-{0}", peacockExpenses), "" }); // Only show event-related if non-zero financialReportRows.Add(new string[] { "Events", string.Format("{0:+#;-#;+0}", eventIncome - eventExpense), "" }); // <LINE> at index 4 financialReportRows.Add(new string[] { "Profit", "", string.Format("{0:+#;-#;+0}", profit) }); // TODO: make expenses that happen right now stand out financialReportRows.Add(new string[] { "Pay Rent", "", string.Format("<b>-{0}</b>", rent) }); // <LINE> at index 7 financialReportRows.Add(new string[] { "New Balance", "", string.Format("{0}", newBalance) }); mOverlayFinancialRenderGroup.UpdateRenderables(financialReportRows, new int[] { 4, 7 }); } /** * Event */ if (EventState.currentEvent != null) { // Set the image in one of two possible spots string focusImage = EventState.currentEventImage; bool isFace = focusImage.Contains("face"); bool isOtherImage = (focusImage != "" && !isFace); Sprite focusSprite = SpriteManager.GetSprite(EventState.currentEventImage); SimulationEventContent.transform.Find("Face").GetComponent <Image>().sprite = null; // clear sprite to reset size information SimulationEventContent.transform.Find("Face").GetComponent <Image>().sprite = focusSprite; SimulationEventContent.transform.Find("Face").GetComponent <Image>().color = EventState.currentEventImageColor; SimulationEventContent.transform.Find("Face").gameObject.SetActive(isFace && focusSprite != null); SimulationEventContent.transform.Find("NonFace/Image").GetComponent <Image>().sprite = null; // clear the sprite in case of weird sprite change bug SimulationEventContent.transform.Find("NonFace/Image").GetComponent <Image>().sprite = focusSprite; SimulationEventContent.transform.Find("NonFace/Image").GetComponent <Image>().color = EventState.currentEventImageColor; SimulationEventContent.transform.Find("NonFace").gameObject.SetActive(isOtherImage && focusSprite != null); // Set the text and options // Set option text on the event buttons GameObject b1 = SimulationEventContent.transform.Find("DecisionPanel/Options/ButtonLeft").gameObject; GameObject b2 = SimulationEventContent.transform.Find("DecisionPanel/Options/ButtonRight").gameObject; GameObject b3 = SimulationEventContent.transform.Find("DecisionPanel/Options/ButtonWide").gameObject; b1.GetComponent <Image>().alphaHitTestMinimumThreshold = 0.2f; b2.GetComponent <Image>().alphaHitTestMinimumThreshold = 0.2f; b3.GetComponent <Image>().alphaHitTestMinimumThreshold = 0.2f; if (EventState.currentEventOptions != null) { SimulationEventContent.transform.Find("DecisionPanel/TextTop").GetComponent <Text>().text = EventState.currentEventText; SimulationEventContent.transform.Find("DecisionPanel/TextFull").GetComponent <Text>().text = ""; b1.SetActive(EventState.currentEventOptions.Length > 1); b2.SetActive(EventState.currentEventOptions.Length > 1); b3.SetActive(EventState.currentEventOptions.Length == 1); if (EventState.currentEventOptions.Length == 1) { b3.GetComponentInChildren <Text>().text = EventState.currentEventOptions[0]; } else { b1.GetComponentInChildren <Text>().text = EventState.currentEventOptions[0]; b2.GetComponentInChildren <Text>().text = EventState.currentEventOptions[1]; } } else { SimulationEventContent.transform.Find("DecisionPanel/TextTop").GetComponent <Text>().text = ""; SimulationEventContent.transform.Find("DecisionPanel/TextFull").GetComponent <Text>().text = EventState.currentEventText; b1.SetActive(false); b2.SetActive(false); b3.SetActive(false); } } if (EpilogueView.activeInHierarchy) { UpdateEpilogueText(); } }
public EnforceBusinessRules(IEnumerable <Rule> rules) { m_state = START; }
public override int GetHashCode() { int hash = 1; if (entityId_ != null) { hash ^= EntityId.GetHashCode(); } if (IataId.Length != 0) { hash ^= IataId.GetHashCode(); } if (CommissionType != 0) { hash ^= CommissionType.GetHashCode(); } if (commissionAmount_ != null) { hash ^= CommissionAmount.GetHashCode(); } if (commissionPercentage_ != null) { hash ^= CommissionPercentage.GetHashCode(); } if (GivenName.Length != 0) { hash ^= GivenName.GetHashCode(); } if (FamilyName.Length != 0) { hash ^= FamilyName.GetHashCode(); } if (BusinessAddress1.Length != 0) { hash ^= BusinessAddress1.GetHashCode(); } if (BusinessAddress2.Length != 0) { hash ^= BusinessAddress2.GetHashCode(); } if (BusinessCity.Length != 0) { hash ^= BusinessCity.GetHashCode(); } if (BusinessState.Length != 0) { hash ^= BusinessState.GetHashCode(); } if (BusinessZip.Length != 0) { hash ^= BusinessZip.GetHashCode(); } if (BusinessNation.Length != 0) { hash ^= BusinessNation.GetHashCode(); } if (BusinessPhoneNumber.Length != 0) { hash ^= BusinessPhoneNumber.GetHashCode(); } if (BusinessFaxNumber.Length != 0) { hash ^= BusinessFaxNumber.GetHashCode(); } if (BusinessEmailAddress.Length != 0) { hash ^= BusinessEmailAddress.GetHashCode(); } return(hash); }