예제 #1
0
    // time money other stuff new script

    void Start()
    {
        playerUI = this.gameObject.GetComponent <PlayerUiController>();
        AddByCateSupp(category, supplier, subCategory);
        AddSupplier();

        // intilise buttons
        allBtn       = transform.Find("CategoryPanel/catListPanel/allBtn").GetComponent <Button>();
        computerBtn  = transform.Find("CategoryPanel/catListPanel/ComputersBtn").GetComponent <Button>();
        hardwareBtn  = transform.Find("CategoryPanel/catListPanel/HardwareBtn").GetComponent <Button>();
        componentBtn = transform.Find("CategoryPanel/catListPanel/ComponetsBtn").GetComponent <Button>();
        gamingBtn    = transform.Find("CategoryPanel/catListPanel/gamningBtn").GetComponent <Button>();
        merchBtn     = transform.Find("CategoryPanel/catListPanel/merchBtn").GetComponent <Button>();

        desktopBtn = transform.Find("CategoryPanel/catListPanel/ComputersBtn/computerPanel/Computerbtn").GetComponent <Button>();
        LaptopBtn  = transform.Find("CategoryPanel/catListPanel/ComputersBtn/computerPanel/Laptopbtn").GetComponent <Button>();

        gpuBtn = transform.Find("CategoryPanel/catListPanel/ComponetsBtn/componentsPanel/GPUbtn").GetComponent <Button>();
        CpuBtn = transform.Find("CategoryPanel/catListPanel/ComponetsBtn/componentsPanel/CPUbtn").GetComponent <Button>();

        pcgameBtn  = transform.Find("CategoryPanel/catListPanel/gamningBtn/GamingPanel/PcGamesBtn").GetComponent <Button>();
        ConsoleBtn = transform.Find("CategoryPanel/catListPanel/gamningBtn/GamingPanel/ConsoleGameBtn").GetComponent <Button>();

        Consoles = transform.Find("CategoryPanel/catListPanel/gamningBtn/GamingPanel/ConsoleBtn").GetComponent <Button>();

        figurineBtn = transform.Find("CategoryPanel/catListPanel/merchBtn/MerchandicePanel/FigurineBtn").GetComponent <Button>();

        keyboardBtn = transform.Find("CategoryPanel/catListPanel/HardwareBtn/HardwarePanel/KeyboardBtn").GetComponent <Button>();
        MiceBtn     = transform.Find("CategoryPanel/catListPanel/HardwareBtn/HardwarePanel/MiceBtn").GetComponent <Button>();

        // When button clicked
        allBtn.GetComponent <Button>().onClick.AddListener(delegate { SetCate("all"); });
        computerBtn.GetComponent <Button>().onClick.AddListener(delegate { SetCate(ItemCategory.Computers.ToString()); });
        hardwareBtn.GetComponent <Button>().onClick.AddListener(delegate { SetCate(ItemCategory.Hardware.ToString()); });
        componentBtn.GetComponent <Button>().onClick.AddListener(delegate { SetCate(ItemCategory.Components.ToString()); });
        gamingBtn.GetComponent <Button>().onClick.AddListener(delegate { SetCate(ItemCategory.Gaming.ToString()); });
        merchBtn.GetComponent <Button>().onClick.AddListener(delegate { SetCate(ItemCategory.Merchandise.ToString()); });
        computerBtn.GetComponent <Button>().onClick.AddListener(delegate { SetCate(ItemCategory.Computers.ToString()); });

        desktopBtn.GetComponent <Button>().onClick.AddListener(delegate { SetSubCate(ItemCategory.Computers.ToString(), ItemSubcategory.Desktop.ToString()); });
        LaptopBtn.GetComponent <Button>().onClick.AddListener(delegate { SetSubCate(ItemCategory.Computers.ToString(), ItemSubcategory.Laptop.ToString()); });

        gpuBtn.GetComponent <Button>().onClick.AddListener(delegate { SetSubCate(ItemCategory.Components.ToString(), ItemSubcategory.GPU.ToString()); });
        CpuBtn.GetComponent <Button>().onClick.AddListener(delegate { SetSubCate(ItemCategory.Components.ToString(), ItemSubcategory.CPU.ToString()); });

        pcgameBtn.GetComponent <Button>().onClick.AddListener(delegate { SetSubCate(ItemCategory.Gaming.ToString(), ItemSubcategory.PCGame.ToString()); });
        ConsoleBtn.GetComponent <Button>().onClick.AddListener(delegate { SetSubCate(ItemCategory.Gaming.ToString(), ItemSubcategory.ConsoleGame.ToString()); });

        Consoles.GetComponent <Button>().onClick.AddListener(delegate { SetSubCate(ItemCategory.Gaming.ToString(), ItemSubcategory.Console.ToString()); });


        figurineBtn.GetComponent <Button>().onClick.AddListener(delegate { SetSubCate(ItemCategory.Merchandise.ToString(), ItemSubcategory.figurines.ToString()); });

        keyboardBtn.GetComponent <Button>().onClick.AddListener(delegate { SetSubCate(ItemCategory.Hardware.ToString(), ItemSubcategory.Keyboard.ToString()); });
        MiceBtn.GetComponent <Button>().onClick.AddListener(delegate { SetSubCate(ItemCategory.Hardware.ToString(), ItemSubcategory.Mouse.ToString()); });
    }