Ejemplo n.º 1
0
 private void Awake()
 {
     menuButtonController = GetComponentInParent <MenuButtonController>();
     animator             = GetComponent <Animator>();
     soundManager         = GetComponentInParent <MainMenuSoundManager>();
     canPlay = false;
 }
Ejemplo n.º 2
0
 private void Start()
 {
     menuButtonController = GetComponentInParent <MenuButtonController>();
     animator             = GetComponent <Animator>();
     animatorFunctions    = GetComponent <AnimatorFunctions>();
     menuButtonFunctions  = GetComponent <MenuButtonFunctions>();
 }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        currentEntreeBox = 0;
        currentDrinkBox  = 100;
        Button b = FindObjectOfType <AddButton>().GetComponent <Button>();
        Button d = FindObjectOfType <DeleteButton>().GetComponent <Button>();
        Button u = FindObjectOfType <UpdateButton>().GetComponent <Button>();

        AddButton add = FindObjectOfType <AddButton>();

        menuButton     = FindObjectOfType <MenuButtonController>();
        menuListPrices = FindObjectOfType <MenuListPrices>();
        restaurantMenu = new RestaurantFineDining();
        restaurant     = FindObjectOfType <Restaurant_Script>();
        menu           = FindObjectOfType <Menu>();



        //Button listener for the add button
        b.onClick.AddListener(delegate() {
            ////Debug.Log("Current: "+currentEntreeBox+" textbox: "+textBoxNum);

            if (menuButton.getEntree() && !selectedString.Equals(""))
            {
                if (textBoxNum == currentEntreeBox)
                {
                    GetComponent <Text>().text = selectedString;
                    selectedItem = new MenuItemClass(selectedString);

                    restaurant.addEntreeToMenu(selectedItem, currentEntreeBox);
                    restaurant.entreePopularity(currentEntreeBox);
                    restaurant.setItemIngredientsCost(selectedString, currentEntreeBox);
                }
                currentEntreeBox++;
            }
            else
            {
                if (textBoxNum == currentDrinkBox)
                {
                    GetComponent <Text>().text = selectedString;
                    selectedItem = new MenuItemClass(selectedString);

                    restaurant.addDrinkToMenu(selectedItem, currentDrinkBox - 100);
                    restaurant.drinkPopularity(currentDrinkBox - 100);
                    restaurant.setItemDrinksCost(selectedString, currentDrinkBox - 100);
                }
                currentDrinkBox++;
            }
        });

        //Button listener for the delete button
        d.onClick.AddListener(delegate(){
        });

        u.onClick.AddListener(delegate(){
            menuListPrices.updateMenu();
            //restaurantMenu.getEntreeMenu();
        });
    }
Ejemplo n.º 4
0
 void Awake()
 {
     if (menuButtonController == null)
     {
         Debug.Log("MENU CONTROLLER NULL: " + this.name);
         menuButtonController = GetComponent <MenuButtonController>();
     }
 }
Ejemplo n.º 5
0
 private void Start()
 {
     LoadVolume();
     if (optionMenu != null)
     {
         menuButtonController = optionMenu.GetComponent <MenuButtonController>();
         isOptions            = menuButtonController.IsAlive();
     }
 }
Ejemplo n.º 6
0
 private void Start()
 {
     // Menu which this button belongs. It assumes it's parent
     menuButtonController = transform.parent.GetComponent <MenuButtonController>();
     // Animator component of this button
     animator = GetComponent <Animator>();
     // AnimatorFunctions component of this button
     animatorFunctions = GetComponent <AnimatorFunctions>();
 }
Ejemplo n.º 7
0
    void Start()
    {
        menuButtonController         = GetComponent <MenuButtonController>();
        menuButtonController.enabled = false;
        logoRectTransform            = logo.GetComponent <RectTransform>();

        foreach (var button in menuButtons)
        {
            button.SetActive(false);
        }
    }
 private void Start()
 {
     // Parent of menus "Menu"
     menu = transform.parent.GetComponent <MenuButtonController>().menu;
     // Array of menus
     menus = menu.transform.GetComponent <MenuActivation>().menus;
     // Controllers
     gamecontroller = transform.parent.GetComponent <MenuButtonController>().gamecontroller;
     // The menu of this button
     menuButtonController = transform.parent.GetComponent <MenuButtonController>();
 }
Ejemplo n.º 9
0
 private void fillCurrentPanel()
 {
     foreach (Transform button in currentPanelObject.transform)
     {
         GameObject.Destroy(button.gameObject);
     }
     foreach (MenuItem x in currentItem.GetChildren())
     {
         GameObject    newButton     = GameObject.Instantiate(buttonTemplate, buttonTemplate.transform.position, Quaternion.identity) as GameObject;
         RectTransform rectTransform = newButton.GetComponent <RectTransform> ();
         Vector3       pos           = rectTransform.position;
         pos.z = 0;
         rectTransform.position = pos;
         newButton.transform.SetParent(currentPanelObject.transform, false);
         MenuButtonController ctrl = newButton.GetComponent <MenuButtonController> ();
         ctrl.itemName = x.name;
         ctrl.level    = currentLevel;
         newButton.SetActive(true);
     }
 }
Ejemplo n.º 10
0
    private void Awake()
    {
        listener     = new List <IPauseListener>();
        totalTime    = 0f;
        totalTime   += GlobalSettingsManager.GetTotalGameTime();
        currentState = GlobalSettingsManager.firstState;

        Timer = totalTime;
        PlantDestroyer.Setup(this);

        new LevelBalancing();
        //fsm = this.GetComponent<FiniteStateMachine>();
        DebugMode = GlobalSettingsManager.debugActive;
        if (!DebugMode)
        {
            debugInfo.gameObject.SetActive(false);
        }

        mBC      = canvas.GetComponent <MenuButtonController>();
        menuOpen = mBC.inMenu;
    }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     // canvasObject = GameObject.Find("Canvas");
     if (canvasObject != null)
     {
         if (canvasObject.GetComponent <Canvas>() != null)
         {
             Canvas canvas = canvasObject.GetComponent <Canvas>();
             menuLoadingSpinner = new MenuLoadingSpinner(canvas, spinnerSprite, spinnerSize);
             menuBtnController  = new MenuButtonController(canvas, menuButtonList, spinnerRadius, buttonDefaultScale, buttonTouchUpScale);
         }
         else
         {
             Debug.Log("Can't find canvas component");
         }
     }
     else
     {
         Debug.Log("Can't find canvas object");
     }
 }
Ejemplo n.º 12
0
    // Awake is called before the first frame update.
    // We use Awake since we want this to be called before the Start of the MenuButtonController.
    void Awake()
    {
        // Find the animator
        anim = this.transform.Find("AnimatedPart").gameObject.GetComponent <Animator>();
        if (anim == null)
        {
            Debug.Log("WARNING: MenuButton could not find animator!");
        }
        // Find the menubuttonController
        menuButtonController = this.transform.parent.GetComponentInChildren <MenuButtonController>();
        if (menuButtonController == null)
        {
            Debug.Log("WARNING: MenuButton could not find menuButtonController!");
        }

        /* Get a reference to the info text */
        InfoText = this.transform.Find("InfoText").gameObject;
        /* Deactivate the info text. It only gets activatet when the button is selected */
        if (InfoText != null)
        {
            InfoText.SetActive(false);
        }
    }
Ejemplo n.º 13
0
    void Start()
    {
        bannerAd.SetPosition(AdPosition.Bottom);

        swipeController.activeItem = data.ActiveEnvironment;

        // Select the Google Play Games platform as our social platform implementation
        GooglePlayGames.PlayGamesPlatform.Activate();

        if (PlayerPrefs.GetInt("logonStatus") == 1 && loginState == GPLoginState.loggedout && !Social.localUser.authenticated)
        {
            Social.localUser.Authenticate(OnAuthCB);              //sign user in automatically
        }

        if (data.userWantsAchievements == 0)
        {
            GameObject           otherGO = GameObject.Find("Leaders");
            MenuButtonController button  = (MenuButtonController)otherGO.GetComponent(typeof(MenuButtonController));
            if (button != null)
            {
                button.disabled = true;
            }
        }
    }
Ejemplo n.º 14
0
    private void Update()
    {
        float rayLength = 100f;

        RaycastHit objectHit;

        targetPosition = transform.forward * rayLength;



        if (Physics.Raycast(transform.position, transform.forward, out objectHit, rayLength))
        {
            if (objectHit.transform.CompareTag("Button"))
            {
                menuButtonControl = (MenuButtonController)objectHit.transform.GetComponent("MenuButtonController");
                menuButtonControl.HighlightButton();
                playSFX(menuSFX);

                if (GvrViewer.Instance.Triggered)
                {
                    audioSource.PlayOneShot(menuClickSFX);
                    menuButtonControl.ClickButton();
                }
            }
            else if (isAudioPlaying)
            {
                audioSource.Stop();
                isAudioPlaying = false;
            }
        }
        else if (isAudioPlaying)
        {
            audioSource.Stop();
            isAudioPlaying = false;
        }
    }
        protected override void Awake()
        {
            base.Awake();

            this.menuBounds = new Circle(GetComponent<RectTransform>().sizeDelta.Min() / 2, GetComponent<RectTransform>().anchoredPosition);
            this.options = new List<MenuButtonController>();
            this.eyeController = GetComponentInChildren<MenuEyeController>();

            OnOpen.AddListener(() =>
            {
                if (!lastSelected)
                    lastSelected = options[0];

                if (!lastSelected.IsSelected)
                    lastSelected.Select();
                else
                    eyeController.LookAt(lastSelected.gameObject);

                if (EvtSystem.currentSelectedGameObject != lastSelected.gameObject)
                    EvtSystem.SetSelectedGameObject(lastSelected.gameObject);
            });

            GetComponentsInChildren<MenuButtonController>(this.options);

            if (this.options.Count <= 0)
                Log.Warn("Not a single option found on the menu.");

            else if (this.options.Count > 1)
            {
                InitOptions();
            }

            showNewGameDialog = new UnityAction(() =>
                ConfirmationDialogController.Show("Start a new game?\n(current progress will be lost)", GameManager.Instance.NewGame, BeginOpening)
            );

            showExitGameDialog = new UnityAction(() =>
                ConfirmationDialogController.Show("Exit game?", GameManager.Instance.Exit, BeginOpening)
            );
        }
 private void InitOptions()
 {
     for (int i = 0; i < this.options.Count; i++)
     {
         int left = i - 1;
         int right = i + 1;
         if (left < 0)
             left = this.options.Count - 1;
         if (right >= this.options.Count)
             right = 0;
         Navigation n = options[i].navigation;
         n.selectOnRight = options[right];
         n.selectOnLeft = options[left];
         options[i].OnSelectionChanged.AddListener(
             (selected, button) => lastSelected = selected ? (MenuButtonController)button : lastSelected);
     }
 }
Ejemplo n.º 17
0
 private void Start()
 {
     menuButtonController = GetComponentInParent <MenuButtonController>();
 }