예제 #1
0
 public static LValue operator >=(LValue a, LValue b)
 {
     switch (a.Type)
     {
     case LType.Number: return(LValue.Real(a.Number >= b.Number ? 1 : 0));
     }
     throw new Exception(String.Format("Could not check if {0} (Type: {2}) is greater than or equal to {1} (Type: {3})", a.ToString(), b.ToString(), a.Type, b.Type));
 }
예제 #2
0
 public static LValue operator /(LValue a, LValue b)
 {
     if (a.Type == LType.Number && b.Type == LType.Number)
     {
         return(LValue.Real(a.Number / b.Number));
     }
     throw new Exception(String.Format("Could not divide {0} (Type: {2}) by {1} (Type: {3})", a.ToString(), b.ToString(), a.Type, b.Type));
 }
예제 #3
0
 public static LValue operator -(LValue a, LValue b)
 {
     if (a.Type == LType.Number && b.Type == LType.Number)
     {
         return(LValue.Real(a.Number - b.Number));
     }
     throw new Exception(String.Format("Could not subtract {0} (Type: {2}) from {1} (Type: {3})", a.ToString(), b.ToString(), a.Type, b.Type));
 }
예제 #4
0
        public static LValue operator !=(LValue a, LValue b)
        {
            switch (a.Type)
            {
            case LType.Number: return(LValue.Real(Math.Abs(a.Number - b.Number) > 0.00001 ? 1 : 0));

            case LType.String: return(LValue.Real(a.String != b.String ? 1 : 0));

            case LType.Undefined: return(LValue.Bool(b.Type != LType.Undefined));
            }
            throw new Exception(String.Format("Could not check if {0} (Type: {2}) is not equal to {1} (Type: {3})", a.ToString(), b.ToString(), a.Type, b.Type));
        }
예제 #5
0
 public static LValue operator +(LValue a, LValue b)
 {
     if (a.Type == LType.Number && a.Type == LType.Number)
     {
         return(LValue.Real(a.Number + b.Number));
     }
     else if (a.Type == LType.String && b.Type == LType.String)
     {
         return(LValue.Text(a.String + b.String));
     }
     throw new Exception(String.Format("Could not add {0} (Type: {2}) to {1} (Type: {3})", a.ToString(), b.ToString(), a.Type, b.Type));
 }
예제 #6
0
파일: VM.cs 프로젝트: nommiin/Luna
        public static void LoadRoom(Game _assets, LRoom _room)
        {
            _assets.CurrentRoom = _room;
            LInstance[] _roomInstances = new LInstance[_room.Instances.Count];
            for (int i = 0; i < _room.Instances.Count; i++)
            {
                LRoomInstance _instGet    = _room.Instances[i];
                LInstance     _instCreate = new LInstance(_assets, _instGet.Index, true, _instGet.X, _instGet.Y);
                _instCreate.Variables["image_xscale"] = LValue.Real(_instGet.ScaleX);
                _instCreate.Variables["image_yscale"] = LValue.Real(_instGet.ScaleY);
                _instCreate.Variables["image_speed"]  = LValue.Real(_instGet.ImageSpeed);
                _instCreate.Variables["image_index"]  = LValue.Real(_instGet.ImageIndex);
                _instCreate.Variables["image_blend"]  = LValue.Real(_instGet.ImageBlend);
                _instCreate.Variables["image_angle"]  = LValue.Real(_instGet.Rotation);
                _instCreate.RoomPreCreate             = _instGet.PreCreate;
                _instCreate.RoomCreate = _instGet.CreationCode;
                _roomInstances[i]      = _instCreate;
            }

            for (int i = 0; i < _roomInstances.Length; i++)
            {
                LInstance _instGet = _roomInstances[i];
                if (_instGet.PreCreate != null)
                {
                    _instGet.Environment.ExecuteCode(_assets, _instGet.PreCreate);
                }
                if (_instGet.RoomPreCreate != null)
                {
                    _instGet.Environment.ExecuteCode(_assets, _instGet.RoomPreCreate);
                }
                if (_instGet.Create != null)
                {
                    _instGet.Environment.ExecuteCode(_assets, _instGet.Create);
                }
                if (_instGet.RoomCreate != null)
                {
                    _instGet.Environment.ExecuteCode(_assets, _instGet.RoomCreate);
                }
            }

            if (_room.CreationCode != null)
            {
                Domain _roomEnvironment = new LInstance(_assets, -100, false).Environment;
                _roomEnvironment.ExecuteCode(_assets, _room.CreationCode);
            }
        }
예제 #7
0
 //Shorthand for Real 1
 public static LValue True()
 {
     return(LValue.Real(1));
 }
예제 #8
0
 //Shorthand for Real 0
 public static LValue False()
 {
     return(LValue.Real(0));
 }