예제 #1
0
 public Procent(MoneyView numerator, MoneyView denominator, bool showMessageAboutOperationFails = true) : base(0f)
 {
     if (denominator.isZero())
     {
         if (showMessageAboutOperationFails)
         {
             Debug.Log("Division by zero in Percent.makeProcent(int)");
         }
         Set(Max999);
     }
     else
     {
         Set((float)(numerator.Get() / denominator.Get()), showMessageAboutOperationFails);
     }
 }
예제 #2
0
 public Money Subtract(MoneyView storage, bool showMessageAboutNegativeValue = true)
 {
     if (storage.isBiggerThan(this))
     {
         if (showMessageAboutNegativeValue)
         {
             Debug.Log("Money subtract failed");
         }
         SetZero();
     }
     else
     {
         data = Get() - storage.Get();
     }
     return(this);
 }
예제 #3
0
        ///////////////////Add section
        public Money Add(MoneyView storage, bool showMessageAboutNegativeValue = true)
        {
            decimal newData = data + storage.Get();

            if (newData < 0m)
            {
                if (showMessageAboutNegativeValue)
                {
                    Debug.Log("Money can't be negative");
                }
                data = 0m;
            }
            else
            {
                data = newData;
            }
            return(this);
        }
예제 #4
0
 public Money(MoneyView value) : base(value)
 {
 }
예제 #5
0
 public void Set(MoneyView value)
 {
     data = (value.Copy()).data;// shit
 }
예제 #6
0
 public bool isSmallerThan(MoneyView value)
 {
     return(data < value.data);
 }
예제 #7
0
 public bool isSmallerOrEqual(MoneyView value)
 {
     return(data <= value.data);
 }
예제 #8
0
        //public bool isBiggerThan(MoneyView invalue, MoneyView barrier)
        //{
        //    throw new System.NotImplementedException();
        //}

        public bool IsEqual(MoneyView value)
        {
            return(data == value.data);
        }
예제 #9
0
 public bool isBiggerThan(MoneyView value)
 {
     return(data > value.data);
 }
예제 #10
0
 public bool isBiggerOrEqual(MoneyView value)
 {
     return(data >= value.data);
 }
예제 #11
0
 protected MoneyView(MoneyView value)
 {
     data = value.data;
 }