public int AddContract(string Name, string CompanyName, int ContractTerm, int ContractQuantity) { int Index = getSalesIndex(Name); if (Index == -1) { Debug.Log("No Info of " + Name + ". Try from " + CompanyName); return(-1); } if (SalesItemArray[Index].ItemCount < ContractQuantity) { return(-2); } List <float> ResultList = BuyItem(Name, CompanyName, ContractQuantity); if (ResultList[0] <= 0) { switch (ResultList[0]) { case -2f: // Contract cannot proceed with not enough stock break; case -1f: // BuyItem will debug it break; case 0f: return(0); } } else { int LackCount = 0; foreach (var value in ResultList) { if (value == 0) { LackCount++; } } if (LackCount > 0) { NotificationManagerCall.AddAlert("Lack of cash. Only " + (ContractQuantity - LackCount).ToString() + " " + Name + " were delivered to you at this time", 1, ""); } } ContractInfo newContent = new ContractInfo(); newContent.CompanyName = CompanyName; newContent.Term = ContractTerm - 1; newContent.Quantity = ContractQuantity; newContent.ContractDate = TimeManagerCall.TimeValue + TimeManagerCall.Month; SalesItemArray[Index].ContractList.Add(newContent); if (SalesItemArray[Index].Seller == CompanyManagerCall.PlayerCompanyName) { NotificationManagerCall.AddNews("Info", CompanyName + " just conclude a contract of " + Name + " for " + ContractTerm + " month"); } return(1); }
// Update is called once per frame void FixedUpdate() { if (CurrentResearchingTech != null) { ObjectActCall.IsWorking = true; if (TimeManagerCall.TimeValue % TimeManagerCall.Hour < TimeManagerCall.PlaySpeed) { if (CurrentResearchingTech != "ResearchPowerUpgrade") { TechValueCall.ContributeResearchWork(CurrentResearchingTech, ResearchPower); } else { if (ResearchPower > ResearchPowerLimit) { ResearchPower = ResearchPowerLimit; } else if (ResearchPower < ResearchPowerLimit) { ResearchPower += Budget * 0.001f; } } } } else if (CurrentDevelopingProduct != null) { ObjectActCall.IsWorking = true; if (TimeManagerCall.TimeValue % TimeManagerCall.Hour < TimeManagerCall.PlaySpeed) { if (CurrentDevelopingProduct.ObjectInfo.RequiredPoint > CurrentDevelopingProduct.CompletedPoint) { CurrentDevelopingProduct.CompletedPoint += ResearchPower / CurrentDevelopingProduct.ObjectInfo.RequiredResearchPower; if (CurrentDevelopingProduct.ObjectInfo.RequiredPoint <= CurrentDevelopingProduct.CompletedPoint && CompanyValueCall.CompanyName == CompanyManagerCall.PlayerCompanyName) { NotificationManagerCall.AddNews("Info", CurrentDevelopingProduct.Name + "'s development process has just been finished"); } } else { CurrentDevelopingProduct.ObjectInfo.Attractiveness.PerfectionPoint += (ResearchPower / CurrentDevelopingProduct.ObjectInfo.RequiredResearchPower) * 0.01f; } if (CompanyValueCall.CompanyName == CompanyManagerCall.PlayerCompanyName) { if (PanelControllerCall.CurrentSidePanel != null) { if (PanelControllerCall.CurrentSidePanel.name == "LabatoryDevelopPanel") { if (PanelControllerCall.CurrentSidePanel.GetComponent <LabatoryDevelopPanelController>().TargetObject == gameObject) { PanelControllerCall.CurrentSidePanel.GetComponent <LabatoryDevelopPanelController>().UpdateProgressInfo(); } } } } } } else if (CurrentResearchingTech == null && CurrentDevelopingProduct == null) { ObjectActCall.IsWorking = false; } }