Example #1
0
 void InitChildToggle(ShopButton.Shop_ButtonID id)
 {
     switch (id)
     {
     case ShopButton.Shop_ButtonID.ELE_Particles: childToggle = true; break;
     }
 }
Example #2
0
 public Element(string name, int subelements, ShopButton.Shop_ButtonID id, ContentCreator.SUBCAT subcategory)
 {
     this.name        = name;
     this.subelements = subelements;
     this.id          = id;
     this.subcategory = subcategory;
 }
Example #3
0
 public Subelement(string name, ShopButton.Shop_ButtonID id, bool canToggle, int cost)
 {
     this.id        = id;
     this.name      = name;
     this.canToggle = canToggle;
     this.cost      = cost;
 }
Example #4
0
    void OnDialogPositive()
    {
        if (_tempID == buttonID)
        {
            if (element != null)
            {
                if (element.childToggle)
                {
                    for (int i = 0; i < element.children.Count; i++)
                    {
                        if (element.children[i].GetComponent <SubelementHandler>()._constructor.purchased)
                        {
                            element.children[i].GetComponent <SubelementHandler>().Toggle(false);
                        }
                    }
                }
            }
            else
            {
                Debug.Log("Element is null");
            }


            _constructor.SetPurchased(true);
            _constructor.SetActive(true);
            _activeImage.enabled = true;
            _activeImage.sprite  = AppResources.Donut_Close;
            Save.SetBool(buttonID + "", _constructor.purchased);
            Save.SetBool(buttonID + "Active", _constructor.active);
            _costText.enabled = !_activeImage.enabled;
            ShopController.Instance.Manage(_tempID, _constructor.active);

            _tempID = ShopButton.Shop_ButtonID.None;
        }
    }
Example #5
0
    /// <summary>
    /// Creates new Graphic of the elements in shop tab
    /// </summary>
    /// <param name="name"></param>
    /// <param name="subelementCount"></param>
    /// <param name="id"></param>
    private void CreateElement(string name, int subelementCount, ShopButton.Shop_ButtonID id, Transform parent, SUBCAT subcategory)
    {
        Element    e     = new Element(name, subelementCount, id, subcategory);
        GameObject clone = (GameObject)Instantiate(elementPrefab);

        clone.transform.SetParent(parent.transform);
        RectTransform rt = clone.GetComponent <RectTransform>();

        rt.localScale    = new Vector3(1, 1, 1);
        rt.localPosition = new Vector3(0, 0, 0);

        rt.offsetMax        = new Vector2(0, 100);
        rt.offsetMin        = new Vector2(0, 0);
        rt.anchoredPosition = new Vector2(0, 0);
        clone.GetComponent <Toggle>().group = parent.GetComponent <ToggleGroup>();
        clone.GetComponent <ElementHandler>().constructor = e;
    }
Example #6
0
    public override void OnPointerClick(PointerEventData data)
    {
        base.OnPointerClick(data);


        if (element != null)
        {
            if (element.childToggle)
            {
                for (int i = 0; i < element.children.Count; i++)
                {
                    if (element.children[i].GetComponent <SubelementHandler>()._constructor.purchased)
                    {
                        element.children[i].GetComponent <SubelementHandler>().Toggle(false);
                    }
                }
            }
        }
        else
        {
            Debug.Log("Element is null");
        }



        if (_constructor.purchased == false)
        {
            if (EventManager.OnSubelementPress != null)
            {
                EventManager.OnSubelementPress(buttonID);
                _tempID = buttonID;
            }
        }
        else
        {
            if (_activeImage != null)
            {
                if (_constructor.canToggle)
                {
                    Toggle(!_constructor.active);
                }
            }
            //ShopController.Instance.Manage(buttonID, _constructor.active);
        }
    }
Example #7
0
    public void Manage(ShopButton.Shop_ButtonID id, bool active)
    {
        switch (id)
        {
        case ShopButton.Shop_ButtonID.SUB_TRIANGLE:     OBJ_TRIANGLE.SetActive(active);                                                                 break;

        case ShopButton.Shop_ButtonID.SUB_SQUARE:               OBJ_SQUARE.SetActive(active);                                                                   break;

        case ShopButton.Shop_ButtonID.SUB_BLOOM:                OBJ_CAMERA.GetComponent <BloomOptimized>().enabled = active;     break;

        case ShopButton.Shop_ButtonID.SUB_FISHEYE:              OBJ_CAMERA.GetComponent <Fisheye>().enabled = active;                    break;

        case ShopButton.Shop_ButtonID.SUB_CIRCLE:               OBJ_CIRCLE.SetActive(active);                                                                   break;

        case ShopButton.Shop_ButtonID.SUB_BAR:                  OBJ_SPECTRUM.SetActive(active);                                                                 break;

        case ShopButton.Shop_ButtonID.SUB_BK_SHADE:     OBJ_BK_SHADE.SetActive(active);                                                                 break;

        case ShopButton.Shop_ButtonID.SUB_BK_DEFAULT:   OBJ_BK_DEFAULT.SetActive(active);                                                               break;
        }
    }
Example #8
0
    void ActivateOnStart(ShopButton.Shop_ButtonID id)
    {
        switch (id)
        {
        case ShopButton.Shop_ButtonID.SUB_TRIANGLE:     OBJ_TRIANGLE.SetActive(Save.GetBool(id + "Active"));                                                            break;

        case ShopButton.Shop_ButtonID.SUB_SQUARE:               OBJ_SQUARE.SetActive(Save.GetBool(id + "Active"));                                                                      break;

        case ShopButton.Shop_ButtonID.SUB_BLOOM:                OBJ_CAMERA.GetComponent <BloomOptimized>().enabled = Save.GetBool(id + "Active");        break;

        case ShopButton.Shop_ButtonID.SUB_FISHEYE:              OBJ_CAMERA.GetComponent <Fisheye>().enabled = Save.GetBool(id + "Active");                       break;

        case ShopButton.Shop_ButtonID.SUB_CIRCLE:               OBJ_CIRCLE.SetActive(Save.GetBool(id + "Active"));                                                                      break;

        case ShopButton.Shop_ButtonID.SUB_BAR:                  OBJ_SPECTRUM.SetActive(Save.GetBool(id + "Active"));                                                            break;

        case ShopButton.Shop_ButtonID.SUB_BK_SHADE:     OBJ_BK_SHADE.SetActive(Save.GetBool(id + "Active"));                                                            break;

        case ShopButton.Shop_ButtonID.SUB_BK_DEFAULT:   OBJ_BK_DEFAULT.SetActive(Save.GetBool(id + "Active"));                                                          break;
        }
    }
Example #9
0
 void OnSubelementPress(ShopButton.Shop_ButtonID id)
 {
     GetComponent <Text>().raycastTarget = true;
 }
Example #10
0
    // private IEnumerator Open(float _duration)
    // {

    //  while (Mathf.Abs(1.0f - _overlay.color.a) > .1f)
    //  {
    //      _overlayAlpha += Time.deltaTime * _duration;
    //      _overlayColor.r = _overlayTargetColor.r;
    //      _overlayColor.g = _overlayTargetColor.g;
    //      _overlayColor.b = _overlayTargetColor.b;
    //      _overlayColor.a = _overlayAlpha;


    //      _containerColor.r = _containerTargetColor.r;
    //      _containerColor.g = _containerTargetColor.g;
    //      _containerColor.b = _containerTargetColor.b;

    //      _containerColor.a = _overlayAlpha;

    //      _overlay.color = _overlayColor;
    //      _containerOverlay.color = _containerColor;
    //      _containerGroup.alpha = _overlayAlpha;
    //      yield return new WaitForSeconds(Time.deltaTime);
    //  }


    //  _overlayAlpha = _overlayTargetColor.a;

    //  _overlay.color = _overlayTargetColor;
    //  _containerOverlay.color = _containerColor;
    //  _containerGroup.alpha = _overlayAlpha;

    // }

    // private IEnumerator Close(float _duration)
    // {

    //  while (Mathf.Abs(0.0f - _overlay.color.a) > .1f)
    //  {
    //      _overlayAlpha -= Time.deltaTime * _duration;

    //      _overlayColor.r = 0.0f;
    //      _overlayColor.g = 0.0f;
    //      _overlayColor.b = 0.0f;

    //      _overlayColor.a = _overlayAlpha;

    //      _containerColor.a = _overlayAlpha;

    //      _overlay.color = _overlayColor;
    //      _containerOverlay.color = _containerColor;
    //      _containerGroup.alpha = _overlayAlpha;
    //      yield return new WaitForSeconds(Time.deltaTime);
    //  }


    //  _overlayAlpha = 0.0f;

    //  _overlayColor.r = 0.0f;
    //  _overlayColor.g = 0.0f;
    //  _overlayColor.b = 0.0f;

    //  _overlay.color = _overlayColor;

    //  _containerOverlay.color = _containerColor;
    //  _containerGroup.alpha = _overlayAlpha;
    // }

    void OnSubelementPress(ShopButton.Shop_ButtonID id)
    {
        StopAllCoroutines();
        SetOpen();
    }
Example #11
0
 public Subelement(string name, ShopButton.Shop_ButtonID id)
 {
     this.id   = id;
     this.name = name;
 }