Пример #1
0
    public void SetContent(Item m, int amount, CombinationController combinationController, System.Action resetAction)
    {
        ItemType type = m.GetItemType();
        int      id   = m.GetId();

        image.sprite               = Resources.Load <Sprite>("Image/" + type.ToString() + id) as Sprite;
        name.text                  = m.GetName();
        this.amount.text           = amount.ToString();
        this.combinationController = combinationController;

        button.onClick.AddListener(() => {
            combinationController.setItemId(id);
            string title   = "확인";
            string message = m.GetName();

            AlertViewController2.Show(title, message, new AlertViewOptions2
            {
                cancelButtonTitle         = "취소",
                itemType                  = type,
                combinationButtonDelegate = () =>
                {
                    combinationController.combination();
                    resetAction();
                },
                decombinationButtonDelegate = () =>
                {
                    combinationController.decombination();
                    resetAction();
                },

                CombinationController = combinationController
            });
        });
    }
Пример #2
0
 public static CombinationController GetInstance()
 {
     if (instance == null)
     {
         instance = new CombinationController();
     }
     return(instance);
 }
Пример #3
0
 private void Awake()
 {
     bowlSuccessPlayed       = false;
     whiskSuccessPlayed      = false;
     rollingPinSuccessPlayed = false;
     combinationController   = GameObject.FindObjectOfType <CombinationController>();
     if (puzzleName == "bowl")
     {
         combination = new Combination("bowl", Vector3.forward, Quaternion.identity);
     }
     else if (puzzleName == "whisk")
     {
         combination = new Combination("whisk", Vector3.forward, Quaternion.identity);
     }
     else if (puzzleName == "rolling-pin")
     {
         combination = new Combination("rolling-pin", Vector3.forward, Quaternion.identity);
     }
 }
Пример #4
0
 void Awake()
 {
     CombinationController = GetComponentInParent <CombinationController>();
 }
Пример #5
0
    // 읽어 들인 내용을 갱신하는 메서드
    public void UpadateContent(
        string title, string message, AlertViewOptions2 options = null)
    {
        if (options != null)
        {
            // 표시 옵션이 있을 때 옵션의 내용에 맞춰 버튼을 표시하거나 표시하지 않는다.
            cancelButton.transform.gameObject.SetActive(options.cancelButtonTitle != null);

            cancelButton.gameObject.SetActive(options.cancelButtonTitle != null);
            cancelButtonDelegate = options.cancelButtonDelegate;

            combinationButtonDelegate   = options.combinationButtonDelegate;
            decombinationButtonDelegate = options.decombinationButtonDelegate;

            combinationController = options.CombinationController;

            itemType = options.itemType;

            message += "아이템은";

            if (options.itemType == ItemType.Material)
            {
                combinatinoButton.interactable   = false;
                decombinationButton.interactable = false;

                message += " 조합 및 분해가 불가능한 아이템입니다. \n";
            }
            else
            {
                if (combinationController.getRecipe().checkRecipe(combinationController.selectedItemId))
                {
                    bool f1 = combinationController.checkCombination();
                    bool f2 = combinationController.checkDecombination();

                    if (f1 && f2)
                    {
                        message += " 조합 및 분해가 가능한 아이텝입니다. \n";
                    }

                    else if (!f1 && f2)
                    {
                        //combinatinoButton.interactable = false;
                        isFinishable = false;
                        combinatinoButton.interactable = true;
                        message += "재료의 수량이 부족하여 조합은 하지 못하지만 분해는 가능합니다.";
                    }
                    else if (f1 && !f2)
                    {
                        decombinationButton.interactable = false;
                        message += "수량이 1개 이하이기 때문에 분해는 못하지만 조합은 가능합니다.";
                    }
                    else
                    {
                        message += " 재료의 수량이 부족하거나 아이템의 개수가 1개 이하이기 때문에 조합 및 분해가 불가능합니다. \n";
                        //combinatinoButton.interactable = false;
                        isFinishable = false;
                        combinatinoButton.interactable   = true;
                        decombinationButton.interactable = false;
                    }

                    //if (!f1)
                    //{
                    //    combinatinoButton.interactable = false;
                    //    message += " 재료의 수량이 부족합니다. \n";
                    //}

                    //if (!f2)
                    //{
                    //    decombinationButton.interactable = false;
                    //    message += " 수량이 1개 이하이면 분해할 수 없습니다. \n";
                    //}
                }
                else
                {
                    message += " 조합 및 분해가 불가능한 아이템입니다. \n";
                    combinatinoButton.interactable   = false;
                    decombinationButton.interactable = false;
                }
            }
        }
        // options = null인 경우
        else
        {
            // 표시 옵션이 지정된 경우 기본 버튼을 표시한다.
            cancelButton.gameObject.SetActive(true);
            combinatinoButton.interactable   = false;
            decombinationButton.interactable = false;
        }

        //타이틀과 메시지를 설정
        titleLabel.text   = title;
        messageLabel.text = message.Replace("\\n", "\n");
    }
Пример #6
0
 private void Awake()
 {
     instance = this;
 }