Inheritance: MonoBehaviour
コード例 #1
0
    public void Start()
    {
        timedButton = transform.Find("TimedButton").gameObject.GetComponent <TimedButton>();

        if (product != null)
        {
            product.UpdateMarketValue();
            product.UpdateUpgradeCost();
            timedButton.profit = product.profitPerUnit;
        }
        else if (entertainment != null)
        {
            entertainment.UpdateMarketValue();
            entertainment.UpdateUpgradeCost();
            timedButton.profit = entertainment.GetIncomePerSecond();
        }
        else if (software != null)
        {
            software.UpdateMarketValue();
            software.UpdateUpgradeCost();
            timedButton.profit = software.GetIncomePerSecond();
        }
        else if (service != null)
        {
            service.UpdateMarketValue();
            service.UpdateUpgradeCost();
            timedButton.profit = service.GetIncomePerSecond();
        }
        else if (item == null)
        {
            Destroy(gameObject);
        }

        transform.Find("Label").gameObject.GetComponent <TextMesh>().text = item.tag;

        timedButton.timeToFinish = item.time;
        timedButton.cost         = item.cost;
        timedButton.retail       = item.price;

        timedButton.viability = item.viability;
        timedButton.customers = item.customers;

        info.transform.Find("CostText").gameObject.GetComponent <TextMesh>().text   = MoneyParsing.ParseMoney(item.adjustedCost);
        info.transform.Find("PriceText").gameObject.GetComponent <TextMesh>().text  = MoneyParsing.ParseMoney(item.adjustedPrice);
        info.transform.Find("ProfitText").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoney(timedButton.profit);

        upgradeButton.transform.Find("txtCost").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoneyWithoutDecimals(item.upgradeCost);
        factoryButton.transform.Find("txtCost").gameObject.GetComponent <TextMesh>().text = MoneyParsing.ParseMoneyWithoutDecimals(item.GetFactoryUpgradeCost());

        // Debug.Log(item.name + ".png");
        timedButtonIcon.GetComponent <MeshRenderer>().material.mainTexture = Resources.Load("ProductIcons/" + item.name) as Texture;

        ToggleInterface();
    }
コード例 #2
0
        void Setup()
        {
            buttons = new Buttons();
            DPad    = new VDPad();
            virtualButtons.AddRange(buttons.bl);
            virtualButtons.AddRange(DPad.bl);

            OnOffMultibutton           = new MultiButton("backStart", buttons.Back, buttons.Start);
            OnOffMultibutton.action[0] = delegate() {
                evaluationAllowed = !evaluationAllowed;
                OutPutLog("Multibutton Back+Start set App to:" + evaluationAllowed);
                Vibrate(0.5f, 0.5f, 300);
                CancelTimed();
            };

            //Custom non default Buttons
            TimedButton altF4 = new TimedButton("altF4", 5000, buttons.LeftShoulder, buttons.RightShoulder, buttons.LeftStick, buttons.RightStick);

            altF4.timedAction = delegate {
                OutPutLog("action altF4");
                Win32.PressKeyDown(Win32.Keys.VK_MENU);
                Win32.PressKeyDown(Win32.Keys.VK_F4);
                Win32.PressKeyUp(Win32.Keys.VK_MENU);
                Win32.PressKeyUp(Win32.Keys.VK_F4);
            };
            virtualButtons.Add(altF4);

            MultiButton muting = new MultiButton("muting", buttons.LeftShoulder, buttons.RightShoulder);

            muting.action[0] = delegate {
                OutPutLog("action muting");
                Win32.Mute();
            };
            virtualButtons.Add(muting);

            OutPutLog("Total buttoncount: " + virtualButtons.Count);
        }