Jump to content

  • Log In with Google      Sign In   
  • Create Account

Madhed

Member Since 13 Jun 2001
Offline Last Active May 21 2016 04:24 PM

Posts I've Made

In Topic: [WIP] UNIStyle - A CSS inspired system for Unity3D GUI styling

30 April 2016 - 06:16 AM

Small update:

 

The parser and themeing system is now fully customizable.

Programmers can add new style properties, types and style sheet functions with a few lines of code.

 

The previously hardcoded parts are now rewritten to use this extension system themselves.

It's already nice to work with but will be refactored to reduce the needed code even more.

 

As a normal user of the system you won't have to touch this code, of course. It is geared towards developers who want to customize the system.

 

The default theme extension:

/// <summary>
/// The default extension for uGUI functionality and basic types
/// </summary>
public class DefaultExtension : ThemeExtension {
 
    public override void AddTypeHandlers(Theme t) {
        t.AddTypeHandler(new FloatTypeHandler());
    }
 
    public override void AddFunctionHandlers(Theme t) {
        t.AddFunctionHandler("lerp", new ColorLerpFunctionHandler());
        t.AddFunctionHandler("lerp", new FloatLerpFunctionHandler());
        t.AddFunctionHandler("lerp", new Vector2LerpFunctionHandler());
        t.AddFunctionHandler("lerp", new Vector3LerpFunctionHandler());
        t.AddFunctionHandler("vec2", new Vec2FunctionHandler());
        t.AddFunctionHandler("vec3", new Vec3FunctionHandler());
        t.AddFunctionHandler("rgba", new RGBAFunctionHandler());
    }
 
    public override void AddPropertyHandlers(Theme t) {
        t.AddTweenablePropertyHandler("font-size", new FontSizePropertyHandler());
        t.AddTweenablePropertyHandler("color", new ColorPropertyHandler());
        t.AddTweenablePropertyHandler("scale", new ScalePropertyHandler());
        t.AddPropertyHandler("font", new FontPropertyHandler());
        t.AddPropertyHandler("sprite", new SpritePropertyHandler());
    }
}

The lerp function for colors:

public class ColorLerpFunctionHandler : GenericParserFunction<Color, Color, float, Color> {
   protected override Color CalculateResult() {
       return arg1 + (arg2 - arg1) * arg3;
   }
}

In Topic: How do you like your eggs in the morning?

04 April 2016 - 02:43 AM

I despise eggs! Ugh! Slimy, nasty, runny bird embryos. :wacko:

 

*Bird period. Unless you're eating balut.

 

Mmh yummy


In Topic: Need some help with A Inventory system using OOP

22 March 2016 - 07:50 AM

What is the problem with your current implementation? It seems you believe there is a better way, what do you have in mind?


In Topic: Please help me remember the name of an old game

21 March 2016 - 06:22 AM

Ha, found it!

 

The game is called Roketz and was released in 1994 on the Amiga and 1996 on the PC.

 

https://www.youtube.com/watch?v=SnAIuJsBQKQ


In Topic: Please help me remember the name of an old game

20 March 2016 - 07:43 PM

 

Nope...

 

 

I believe the game also had some kind of racing element IIRC but I'm not sure. I think the main objective was to finish laps and shooting the other player was just a bonus.


PARTNERS