示例#1
0
    //IBundle
    public object Property(Toy.Interpreter interpreter, Toy.Token token, object argument)
    {
        string propertyName = (string)argument;

        switch (propertyName)
        {
//			case "GetStatistics":
        case "Move": return(new Move(this));

//			case "Check":
//			case "Attack":
//			case "Pickup":
//			case "Drop":

        case "GetDisplayName": return(new GetDisplayNameCallable(this));

        case "GetSpriteName": return(new GetSpriteNameCallable(this));

        case "PositionX": return(new AssignableProperty(val => this.positionX = (int)(double)val, x => (double)this.positionX));

        case "PositionY": return(new AssignableProperty(val => this.positionY = (int)(double)val, x => (double)this.positionY));

        default:
            throw new ErrorHandler.RuntimeError(token, "Unknown property '" + propertyName + "'");
        }
    }
示例#2
0
        public object Call(Toy.Interpreter interpreter, Toy.Token token, List <object> arguments)
        {
            if (!(arguments[0] is string))
            {
                self.FindGameController();
                self.gameController.ShowError("stat name must be a string");
            }

            return(self.GetStat((string)arguments[0]));
        }
示例#3
0
    //IBundle
    public object Property(Toy.Interpreter interpreter, Toy.Token token, object argument)
    {
        string propertyName = (string)argument;

        switch (propertyName)
        {
        case "GetStat": return(new GetStatCallable(this));

        case "SetStat": return(new SetStatCallable(this));

        default:
            throw new Toy.ErrorHandler.RuntimeError(token, "Unknown property '" + propertyName + "'");
        }
    }
示例#4
0
    //IBundle
    public object Property(Toy.Interpreter interpreter, Toy.Token token, object argument)
    {
        string propertyName = (string)argument;

        switch (propertyName)
        {
        case "GetDisplayName": return(new GetDisplayNameCallable(this));

        case "GetSpriteName": return(new GetSpriteNameCallable(this));

        case "GetType": return(new GetTypeCallable(this));

        case "GetDamage": return(new GetDamageCallable(this));

        case "PositionX": return(new AssignableProperty(val => this.positionX = (int)(double)val, x => (double)this.positionX));

        case "PositionY": return(new AssignableProperty(val => this.positionY = (int)(double)val, x => (double)this.positionY));

        default:
            throw new ErrorHandler.RuntimeError(token, "Unknown property '" + propertyName + "'");
        }
    }