GetColorFromHex() public static method

public static GetColorFromHex ( uint hex ) : Color
hex uint
return Color
    void Start()
    {
        state = STATE_SPLASH;

        FutileParams fparams = new FutileParams(true, true, false, false); //landscape left, right, portrait, portraitUpsideDown

        fparams.AddResolutionLevel(1024.0f, 1.0f, 1.0f, "");               //max width, displayScale, resourceScale, resourceSuffix

        fparams.backgroundColor = RXUtils.GetColorFromHex("555555");
        fparams.origin          = new Vector2(0.5f, 0.5f);

        Futile.instance.Init(fparams);

        Futile.atlasManager.LoadAtlas("Atlases/lake_monster2");
        Futile.atlasManager.LogAllElementNames();

        MetaContainer.loadFont("Arial-Black", 120, "arial_black_120", "Atlases/arial_black_120", 0f, 0f);
        MetaContainer.loadFont("BrushScriptStd", 16, "BrushScriptStd_64", "Atlases/BrushScriptStd_64", 4f, -12f);

        ScreenManager.init(this, "");

        splash = new GameScreen("greetings_lochness_cleanup");
        splash.buttons["start"].SignalRelease += handleLevels;
        ScreenManager.loadScreen(splash, ScreenSourceDirection.Instant);
    }
Esempio n. 2
0
    public bool TestForHumans()
    {
        //no need to cache rects, we're comparing many:1 not many:many
        foreach (Human human in humans)
        {
            Rect test = new Rect(human.x - human.body.width / 2, human.y - human.body.height / 2, human.body.width, human.body.height);

            if (tentaclePieces.Count > 0)
            {
                //just the tip of the tentacle
                FSprite tentacle = tentaclePieces.GetLastObject();
                if (TestCircleRect(tentacle.x, tentacle.y, tentacle.width / 2, test))
                {
                    tentacle.color = RXUtils.GetColorFromHex("ff0000");
                    hasAHuman      = true;
                    fishFood       = human;
                    humans.Remove(human);
                    return(true);
                }
                else
                {
                    tentacle.color = RXUtils.GetColorFromHex("ffffff");
                }
            }
        }

        return(false);
    }
Esempio n. 3
0
    public void Init(FContainer container, uint color, bool shouldUpdateColliders)
    {
        _container = container;

        _container.AddChild(_drawHolder = new FContainer());

        _color = RXUtils.GetColorFromHex(color);

        this.shouldUpdateColliders = shouldUpdateColliders;

        Collider[] colliders = gameObject.GetComponents <Collider>();

        int colliderCount = colliders.Length;

        for (int c = 0; c < colliderCount; c++)
        {
            Collider collider = colliders[c];

            FNode newNode = null;

            if (collider is BoxCollider)
            {
                FSprite sprite = new FSprite("Debug/Square");
                sprite.color = _color;

                newNode = sprite;
            }
            else if (collider is SphereCollider)
            {
                FSprite sprite = new FSprite("Debug/Circle");
                sprite.color = _color;

                newNode = sprite;
            }

            if (newNode != null)
            {
                _drawHolder.AddChild(newNode);
                _nodes.Add(newNode);
            }
        }

        FPPolygonalCollider mesh2D = gameObject.GetComponent <FPPolygonalCollider>();

        if (mesh2D != null)
        {
            FPDebugPolygonColliderView debugView = new FPDebugPolygonColliderView("Debug/Triangle", mesh2D);
            debugView.color = _color;

            _drawHolder.AddChild(debugView);
            _nodes.Add(debugView);
        }

        Update();
        if (!shouldUpdateColliders)
        {
            UpdateColliders();                                //always update the colliders the first time
        }
    }
Esempio n. 4
0
    private void Start()
    {
        instance = this;

        Go.defaultEaseType       = EaseType.Linear;
        Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty;

        //Time.timeScale = 0.1f;

        bool isIPad = SystemInfo.deviceModel.Contains("iPad");

        bool shouldSupportPortraitUpsideDown = isIPad;         //only support portrait upside-down on iPad

        FutileParams fparams = new FutileParams(true, true, true, shouldSupportPortraitUpsideDown);

        fparams.backgroundColor = RXUtils.GetColorFromHex(0x212121);
        fparams.shouldLerpToNearestResolutionLevel = true;
        fparams.resolutionLevelPickMode            = FResolutionLevelPickMode.Downwards;

        fparams.AddResolutionLevel(640.0f, 1.0f, 1.0f, "");
        fparams.AddResolutionLevel(1280.0f, 2.0f, 1.0f, "");
        fparams.AddResolutionLevel(1920.0f, 3.0f, 1.0f, "");
        fparams.AddResolutionLevel(2560.0f, 4.0f, 1.0f, "");

        fparams.origin = new Vector2(0.5f, 0.5f);

        Futile.instance.Init(fparams);

        FFacetType.Quad.maxEmptyAmount  = 100;
        FFacetType.Quad.expansionAmount = 100;
        FFacetType.Quad.initialAmount   = 100;

        FAtlas mainAtlas = Futile.atlasManager.LoadAtlas("Atlases/MainAtlas");

        mainAtlas.texture.filterMode = FilterMode.Point;

        TOFonts.Load();

        Config.Setup();

        Wolf.WolfAnimation.SetupAnimations();
        Human.HumanAnimation.SetupAnimations();

        core = new Core();
        Futile.stage.AddChild(core);

        //FSoundManager.PlayMusic ("NormalMusic",0.5f);

        Futile.screen.SignalResize += HandleSignalResize;
        HandleSignalResize(false);
    }
Esempio n. 5
0
    public static void init(MonoBehaviour handler, string backdropSprite = "")
    {
        coroutineHandler = handler;

        backdrop = null;
        if (backdropSprite != "")
        {
            backdrop        = new FSprite(backdropSprite);
            backdrop.scaleX = Futile.screen.width / backdrop.width;
            backdrop.scaleY = Futile.screen.height / backdrop.height;
            // NOTE: The following two lines recolor the backdrop sprite
            backdrop.shader = FShader.SolidColored;
            backdrop.color  = RXUtils.GetColorFromHex("555555");
        }

        screenLayer = new FContainer();

        Futile.stage.AddChild(screenLayer);
    }
Esempio n. 6
0
    private void Start()
    {
        Go.defaultEaseType       = EaseType.Linear;
        Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty;

        // Uncomment if you need to delete bad save data on startup
        // PlayerPrefs.DeleteAll();

        //Time.timeScale = 0.1f; //use for checking timings of things in slow motion

        FutileParams fparams = new FutileParams(true, true, false, false);

        fparams.backgroundColor = RXUtils.GetColorFromHex(0x050122);
        fparams.shouldLerpToNearestResolutionLevel = false;
        fparams.resolutionLevelPickMode            = FResolutionLevelPickMode.Closest;

        bool shouldHaveScale1 = true;
        bool shouldHaveScale2 = true;
        bool shouldHaveScale4 = true;

                #if UNITY_WEBPLAYER
        //webplayer has everything but scale2 stripped out
        shouldHaveScale1 = false;
        shouldHaveScale4 = false;
                #endif

        if (shouldHaveScale1)
        {
            fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "_Scale1");                                      //iPhone
        }
        if (shouldHaveScale2)
        {
            fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2");                                      //iPhone retina
        }
        if (shouldHaveScale2)
        {
            fparams.AddResolutionLevel(1024.0f, 2.0f, 2.0f, "_Scale2");                                     //iPad
        }
        if (shouldHaveScale2)
        {
            fparams.AddResolutionLevel(1136.0f, 2.0f, 2.0f, "_Scale2");                                     //iPhone 5 retina
        }
        if (shouldHaveScale2)
        {
            fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2");                                     //Nexus 7
        }
        if (shouldHaveScale4)
        {
            fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4");                                     //iPad Retina
        }
        //FOR SCREENSHOTS
//		if(shouldHaveScale1) fparams.AddResolutionLevel(480.0f,		1.0f,	2.0f,	"_Scale2"); //iPhone
//		if(shouldHaveScale2) fparams.AddResolutionLevel(960.0f,		2.0f,	2.0f,	"_Scale2"); //iPhone retina
//		if(shouldHaveScale2) fparams.AddResolutionLevel(1024.0f,	2.0f,	4.0f,	"_Scale4"); //iPad
//		if(shouldHaveScale2) fparams.AddResolutionLevel(1136.0f,	2.0f,	4.0f,	"_Scale4"); //iPhone 5 retina
//		if(shouldHaveScale2) fparams.AddResolutionLevel(1280.0f,	2.0f,	4.0f,	"_Scale4"); //Nexus 7
//		if(shouldHaveScale4) fparams.AddResolutionLevel(2048.0f,	4.0f,	4.0f,	"_Scale4"); //iPad Retina

        fparams.origin = new Vector2(0.5f, 0.5f);

        Futile.instance.Init(fparams);

        Futile.atlasManager.LoadAtlas("Atlases/MainAtlas");
        //Futile.atlasManager.LoadImage("Atlases/Fonts/Raleway");
        //Futile.atlasManager.LoadImage("Atlases/Fonts/Ostrich");

        FTextParams textParams;

        textParams = new FTextParams();
        textParams.kerningOffset    = -0.0f;
        textParams.lineHeightOffset = -15.0f;
        Futile.atlasManager.LoadFont("Raleway", "Fonts/Raleway" + Futile.resourceSuffix, "Atlases/Fonts/Raleway" + Futile.resourceSuffix, -1.0f, -1.0f, textParams);

//
//		textParams = new FTextParams();
//		textParams.kerningOffset = -0.0f;
//		textParams.lineHeightOffset = -15.0f;
//		Futile.atlasManager.LoadFont("Ostrich","Atlases/Fonts/Ostrich", "Atlases/Fonts/Ostrich"+Futile.resourceSuffix, 0.0f,-2.0f,textParams);
//
        for (int s = 0; s < 10; s++)
        {
            FSoundManager.PreloadSound("Musical/Note" + s + "_bass");
            FSoundManager.PreloadSound("Musical/Note" + s + "_normal");
        }

        Futile.stage.AddChild(new Keeper());         //keeper statically retains itself and never gets removed
    }
Esempio n. 7
0
    public bool TestForCollisions()
    {
        Dictionary <Enemy, Rect> cached_rects = new Dictionary <Enemy, Rect>();

        foreach (Enemy enemy in enemies)
        {
            if (!cached_rects.ContainsKey(enemy))
            {
                //this code puts bright orange debug rects over the rect of the sonar bits

                if (!debugRects.ContainsKey(enemy))
                {
                    debugRects[enemy] = new FSprite("debug_rect");
//					AddChild(debugRects[enemy]);
                }

                Vector2 sonar_pos = enemy.LocalToOther(enemy.sonar.GetPosition(), this);
                cached_rects[enemy] = new Rect(sonar_pos.x - enemy.sonar.width / 2,
                                               sonar_pos.y - enemy.sonar.height / 2,
                                               enemy.sonar.width,
                                               enemy.sonar.height);

//				debugRects[enemy].x = cached_rects[enemy].center.x;
//				debugRects[enemy].y = cached_rects[enemy].center.y;
//				debugRects[enemy].width = cached_rects[enemy].width;
//				debugRects[enemy].height = cached_rects[enemy].height;
            }
        }


        foreach (TentaclePiece tentacle in tentaclePieces)
        {
            bool got_one = false;
            foreach (Enemy enemy in enemies)
            {
                //first see if we're even in the rect...
                if (TestCircleRect(tentacle.x, tentacle.y, tentacle.width / 2, cached_rects[enemy]))
                {
                    Vector2 vertex_a = enemy.LocalToOther(enemy.sonar_vert_1, this);
                    Vector2 vertex_b = enemy.LocalToOther(enemy.sonar_vert_2, this);
                    Vector2 vertex_c = enemy.LocalToOther(enemy.sonar_vert_3, this);

                    if (TestPointInTriangle(vertex_a.x, vertex_a.y, vertex_b.x, vertex_b.y, vertex_c.x, vertex_c.y, tentacle.tipX, tentacle.tipY))
                    {
                        got_one = true;
                        return(true);
                    }
                }
            }

            if (got_one)
            {
                tentacle.color = RXUtils.GetColorFromHex("ff0000");
            }
            else
            {
                tentacle.color = RXUtils.GetColorFromHex("ffffff");
            }
        }

        return(false);
    }