Ejemplo n.º 1
0
 public void BalanceValueCheck()
 {
     if (CurrentBank != "")
     {
         int InputValue = int.Parse(LoanFunctionPanel.transform.GetChild(1).gameObject.GetComponent <InputField>().text);
         if (InputValue < 0)
         {
             LoanFunctionPanel.transform.GetChild(1).gameObject.GetComponent <InputField>().text = "0";
         }
         else
         {
             int MaxLoanValue = Mathf.FloorToInt(CallBankValue.EvaluateCostomer(CurrentBank, CallCompanyValue)[1]);
             if (MaxLoanValue < InputValue)
             {
                 CallNotificationManager.AddAlert("You cannot loan over $" + MaxLoanValue, 1, "");
             }
         }
     }
     else
     {
         ClearDealFunction();
     }
 }
    public void ConfirmButtonSelect()
    {
        string Inputs = ResultItemNameInputFieldObject.GetComponent <InputField>().text;

        if (CallGoodsRecipe.GetRecipe(Inputs) != null)
        {
            CallNotificationManager.AddAlert("Goods name is already exist!", 1, "");
            return;
        }

        string ButtonText  = MainFunctionButton.transform.GetChild(0).gameObject.GetComponent <Text>().text;
        Color  ButtonColor = MainFunctionButton.gameObject.GetComponent <Image>().color;

        if (CallTargetLabatoryAct.CurrentDevelopingProduct == null)
        {
            ResultItemNameInputFieldObject.GetComponent <InputField>().interactable        = false;
            MainFunctionButton.transform.GetChild(0).gameObject.GetComponent <Text>().text = "Cancel";
            MainFunctionButton.gameObject.GetComponent <Image>().color = new Color(1f, 0.4f, 0.4f, 1f);

            FirstItemImageObject.transform.parent.gameObject.GetComponent <Button>().interactable  = false;
            SecondItemImageObject.transform.parent.gameObject.GetComponent <Button>().interactable = false;
            ProcessorImageObject.transform.parent.gameObject.GetComponent <Button>().interactable  = false;

            CallTargetLabatoryAct.StartDeveloping(Inputs);
        }
        else
        {
            MainFunctionButton.transform.GetChild(0).gameObject.GetComponent <Text>().text = "Start";
            MainFunctionButton.gameObject.GetComponent <Image>().color = new Color(1f, 1f, 1f, 1f);

            ClaerInputPanel();
            ClearResultInfoPanel();
            ClearProgressInfoPanel();
            NameInputFieldValueChange();

            CallTargetLabatoryAct.EndDeveloping();
        }

        CallPanelController.CurrentFloatingPanel.GetComponent <ObjectInfoPanelController>().DisplayInfo();
    }
Ejemplo n.º 3
0
    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);
    }