コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if ((stopSignal == false) && (_countOfMadeConnections != 0))
     {
         try
         {
             foreach (Circuit sim in simList)
             {
                 sim.doTick();
             }
         }
         catch (Circuit.Exception e)
         {
             MainMenuButtons.CircuitError(e.element);
             stopSignal = true;
         }
         catch (NullReferenceException e)
         {
             stopSignal = true;
         }
         //MainMenuButtons.CircuitError(e.element);
         foreach (GameObject obj in UnityEngine.Object.FindObjectsOfType(typeof(GameObject)))
         {
             if (obj.tag.Equals("ActiveItem") && obj.name.Contains("Ampermeter"))
             {
                 if (obj.GetComponent <GUIAmpermeter>().ResistorComponent.getCurrent() > 10)
                 {
                     string resErrorMsg = ResourceReader.Instance.GetResource("CircuitErrorMSG2");
                     FindObjectOfType <Whisp>().Say(resErrorMsg);
                     stopSignal = true;
                 }
             }
         }
     }
 }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        // Get the main menu controller
        mainController = mainUI.gameObject.GetComponent <MainMenuButtons>();

        // Get the current canvas
        optionsUI = gameObject.GetComponent <Canvas>();

        // Get the joystick input manager
        joystick = gameObject.GetComponent <JoystickMenuInput>();

        selectorPos = (RectTransform)selector.transform;
        buttonPos   = (RectTransform)UIElements[0].transform;
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        // Try to get the main UI thingy
        try
        {
            buttons = GameObject.FindGameObjectWithTag("MainUI").GetComponent <MainMenuButtons>();
        }
        // If that doesn't work,
        catch
        {
            // Get the other UI manager thingy
            try
            {
                options = GameObject.FindGameObjectWithTag("OptionsUI").GetComponent <OptionsMenuManager>();
            }
            // and if that doesnt work,
            catch
            {
                // do nothing hahahaa
            }
        }


        // Try to steal the duration from the main UI thingy
        try
        {
            duration = buttons.duration;
        }
        // If that doesn't work,
        catch
        {
            // Try stealing it from the other thing
            try
            {
                duration = options.duration;
            }
            // and if that doesn't work somehow,
            catch
            {
                // do nothing hehehehe
            }
        }

        // get the recttransform to change the position later
        pos = (RectTransform)gameObject.transform;
    }
コード例 #4
0
    // Use this for initialization
    void Awake()
    {
        button            = GetComponent <Button>();
        initialColorBlock = button.colors;
        canvasController  = GameObject.Find("CanvasController");
        mainMenuButtons   = canvasController.GetComponent <MainMenuButtons>();


        selectedColorBlock.normalColor      = mainMenuButtons.selectedNormalColor;
        selectedColorBlock.highlightedColor = mainMenuButtons.selectedHighlighedColor;
        selectedColorBlock.pressedColor     = mainMenuButtons.selectedPressedColor;
        selectedColorBlock.colorMultiplier  = 1;

        unavailableColorBlock.normalColor      = mainMenuButtons.unavailableColor;
        unavailableColorBlock.highlightedColor = mainMenuButtons.unavailableColor;
        unavailableColorBlock.pressedColor     = mainMenuButtons.unavailableColor;
        unavailableColorBlock.colorMultiplier  = 1;
    }
コード例 #5
0
ファイル: MainMenu.cs プロジェクト: Zephyr6/StackTracer2
        void SelectActivity()
        {
            if (mGamePad.LeftStick.Position.Y > 0)
            {
                beep.Play();

                if (currentButton == MainMenuButtons.Start)
                    currentButton = MainMenuButtons.Start;

                else if (currentButton == MainMenuButtons.About)
                    currentButton = MainMenuButtons.Start;

                else if (currentButton == MainMenuButtons.Exit)
                    currentButton = MainMenuButtons.About;
            }
            else if (mGamePad.LeftStick.Position.Y < 0)
            {
                beep.Play();

                if (currentButton == MainMenuButtons.Start)
                    currentButton = MainMenuButtons.About;

                else if (currentButton == MainMenuButtons.About)
                    currentButton = MainMenuButtons.Exit;

                else if (currentButton == MainMenuButtons.Exit)
                    currentButton = MainMenuButtons.Exit;
            }

            canMove = false;
        }
コード例 #6
0
ファイル: MainMenuButtons.cs プロジェクト: marshl/Leviathan2
 private void Awake()
 {
     MainMenuButtons.instance = this;
     this.mainPanelObj.SetActive( true );
     this.currentState = STATE.MAIN;
 }