Beispiel #1
0
    public void LevelUP(int id, int amount)
    {
        Delegates.VoidCallback callback = () => { LevelUpCallback(id, amount); };
        switch (mInfoArr[id].CostType)
        {
        case eCostType.Gold:
        {
            GameController.Instance.GoldCallback = callback;
            double cost = mInfoArr[id].CostCurrent;
            if (amount == 10)
            {
                cost *= mInfoArr[id].CostTenWeight;
            }
            GameController.Instance.Gold -= cost;
        }

        break;

        case eCostType.Ruby:
        {
            double cost = 10 * amount;
        }
        break;

        case eCostType.Soul:
            break;

        default:
            Debug.LogError("wrong cost type " + mInfoArr[id].CostType);
            break;
        }
    }
Beispiel #2
0
 public void ButtonCallAdd()
 {
     mCallback += () =>
     {
         Debug.Log("Test!!");                //매서드 여러개 중첩가능
     };
 }
Beispiel #3
0
    public void LevelUP(int id, int amount)
    {
        Delegates.VoidCallback callback = () => { LevelUpCallback(id, amount); };
        GameController.Instance.GoldCallback = callback;
        double cost = mInfoArr[id].CostCurrent;

        GameController.Instance.Gold -= cost;
    }
Beispiel #4
0
    public void AddStage(int id, int amount)
    {
        Delegates.VoidCallback callback = () => { AddStageCallback(id, amount); };

        GameController.Instance.GoldCallback = callback;
        double cost = 100000 * math.pow(2.1, id - 1);

        GameController.Instance.Gold -= cost;
    }
Beispiel #5
0
    public void BuyMine(int id, int amount)
    {
        Delegates.VoidCallback callback = () => { BuyCallback(id, amount); };
        GameController.Instance.GoldCallback = callback;
        double cost = mInfoArr[id].Cost;

        GameController.Instance.Gold        -= cost;
        GameController.Instance.MineTutorial = 1;
    }
Beispiel #6
0
 public void UseGold(float amount, Delegates.VoidCallback callback = null)
 {
     if (mGold >= amount)
     {
         mGold -= amount;
         if (callback != null)
         {
             callback();
         }
     }
     else
     {
         Debug.Log("Not enough gold " + amount);
     }
 }
Beispiel #7
0
    //public int[] GetSaveData() //수동 세이브 방식
    //{
    //    int[] result = new int[mInfoArr.Length];
    //    for(int i=0; i<mInfoArr.Length; i++)
    //    {
    //        result[i] = mInfoArr[i].CurrentLevel;
    //    }
    //    return result;
    //}

    //private int mSelectedID, mSelectedAmount; //LevelUP메서드에서 LevelUPCallback을 불러오기 위해 Delegates사용

    public void LevelUP(int id, int amount)
    {
        //mSelectedID = id;
        //mSelectedAmount = amount;
        Delegates.VoidCallback callback = () => { LevelUPCallback(id, amount); };

        switch (mInfoArr[id].CostType)
        {
        case eCostType.Gold:
        {                                                    //지역변수 cost를 Ruby에서도 사용하기 위함
            GameController.Instance.GoldCallback = callback; //대입 (중첩+= X)
            //등비수열 합공식을 이용한 비용 계산
            double cost = mInfoArr[id].CostCurrent;
            if (amount == 10)
            {
                cost *= mInfoArr[id].CostTenWeight;
            }
            GameController.Instance.Gold -= cost;
            //GameController.Instance.Gold -= mInfoArr[id].CostCurrent; 위의 공식을 사용해서 계산 (X10UP도 있으므로)
        }
        break;

        case eCostType.Ruby:
        {
            double cost = 10 * amount;
        }
        break;

        case eCostType.Soul:
            break;

        default:     //잘못된 코스트타입이 입력될 때
            Debug.LogError("Wrong cost type" + mInfoArr[id].CostType);
            break;
        }
        //GameController.Instance.GoldCallback = LevelUPCallback;
        //GameController.Instance.Gold -= 2;
    }
Beispiel #8
0
    private int mSelectedID, mSelectedAmount; //필드변수 사용하여 처리하는방법

    public void LevelUP(int id, int amount)
    {
        //mSelectedID = id;//필드변수 사용하여 처리하는방법
        //mSelectedAmount = amount;//필드변수 사용하여 처리하는방법
        Delegates.VoidCallback callback = () => { LevelUpCallback(id, amount); };//필드변수x 람다식
        switch (mInfoArr[id].CostType)
        {
        case eCostType.Gold:
            GameController.Instance.GoldCallback = callback;     //골드가 충분한지 확인후 진행. 어려우면 USEGOLD ex)textrpg
            GameController.Instance.Gold        -= mInfoArr[id].CostCurrent;
            break;

        case eCostType.Rubby:
            break;

        case eCostType.Soul:
            break;

        default:
            Debug.LogError("wrong cost type " + mInfoArr[id].CostType);
            break;
        }
    }
Beispiel #9
0
 public void OpenPopup(Delegates.VoidCallback callback)
 {
     mdelegates = callback;
 }