Beispiel #1
0
    void Start()
    {
        Profile profile = sProfileManager.ProfileSingleton;

        foreach (ProfileLevels PL in profile.profileLevels)
        {
            if (profile.stars >= PL.starsToUnlock && PL.locked == true)
            {
                PL.locked = false;
            }
        }


        StarsText.text = profile.stars.ToString();
        foreach (ProfileLevels PL in profile.profileLevels)
        {
            GameObject go = (GameObject)GameObject.Instantiate(buttonPrefab);
            go.GetComponent <MenuLevel>().myProfileLevel = PL;
            go.transform.SetParent(anchor.transform);
            go.transform.localScale = Vector3.one;
        }
        anchor.GetComponent <UIGrid>().Reposition();
        anchor.GetComponentInParent <UIScrollView>().ResetPosition();



        string[] flags = Localization.dictionary["Flag"];
        for (int i = 0; i < Localization.knownLanguages.Length; i++)
        {
            GameObject go = (GameObject)GameObject.Instantiate(languagePrefab);
            FlagSprite fs = go.GetComponent <FlagSprite>();
            fs.myLanguage = Localization.knownLanguages[i];
            fs.myImage    = flags[i];
            if (Localization.language == Localization.knownLanguages[i])
            {
                fs.Set = true;
            }
            else
            {
                fs.Set = false;
            }


            go.transform.SetParent(languageAnchor.transform);
            go.transform.localScale = Vector3.one;
        }
        languageAnchor.GetComponent <UIGrid>().Reposition();
        //languageAnchor.GetComponent<UIGrid>().repositionNow = true;
        //languageAnchor.GetComponentInParent<UIScrollView>().ResetPosition();

        VersionScrollView.ResetPosition();
    }
        public Sprite MakeProduct(int x)
        {
            sprite = (spriteType)x;

                sourceRect.Width = 16;
                sourceRect.X = 0;
                sourceRect.Y = 0;
                sourceRect.Height = 16;
                timePerFrame = 0;
                switch (sprite)
                {
                    case spriteType.questionBlock:
                    {
                        numberOfFrames = 3;
                        timePerFrame = 250;
                        sourceRect.X = 368;
                        sourceRect.Width = 48;
                        Sprite blockQuestion = new BlockQuestionSprite(game.scene, Vector2.Zero, texture, sourceRect, timePerFrame, numberOfFrames,true);
                        return blockQuestion;
                    }
                    case spriteType.brickBlock:
                    {
                        sourceRect.X = 30;
                        Sprite blockBrick = new BlockBrickSprite(game.scene, Vector2.Zero, texture, sourceRect, 0, numberOfFrames, false);
                        return blockBrick;
                    }

                    case spriteType.brokenBlock:
                    {
                        sourceRect.X = 64;
                        sourceRect.Y = 0;
                        sourceRect.Width = 16;
                        sourceRect.Height = 16;
                        Sprite blockBrick = new BlockBrokenSprite(game.scene, Vector2.Zero, texture2, sourceRect, 0, numberOfFrames, false);
                        return blockBrick;
                    }
                    case spriteType.floorBlock:
                    {
                        Sprite blockFloor = new BlockFloorSprite(game.scene, Vector2.Zero, texture, sourceRect, 0, numberOfFrames, false);
                        return blockFloor;
                    }
                    case spriteType.pyramidBlock:
                    {
                        sourceRect.Y = 16;
                        Sprite blockPyramid = new BlockPyramidSprite(game.scene, Vector2.Zero, texture, sourceRect, 0, numberOfFrames, false);
                        return blockPyramid;
                    }
                    case spriteType.usedBlock:
                    {
                        sourceRect.X = 48;
                        Sprite blockUsed = new BlockUsedSprite(game.scene, Vector2.Zero, texture, sourceRect, 0, numberOfFrames, false);
                        return blockUsed;
                    }
                    case spriteType.hiddenBlock:
                    {
                        sourceRect.X = 432;
                        Sprite blockHidden = new BlockHiddenSprite(game.scene, Vector2.Zero, texture, sourceRect, 0, numberOfFrames, false);
                        return blockHidden;
                    }
                    case spriteType.flagBulb:
                    {
                        sourceRect.X = 256;
                        sourceRect.Y = 136;
                        sourceRect.Width = 16;
                        sourceRect.Height = 8;
                        Sprite bulb = new FlagBulbSprite(game.scene, Vector2.Zero, texture, sourceRect, 0, numberOfFrames, false);
                        return bulb;
                    }
                    case spriteType.flagPole:
                    {
                        sourceRect.X = 256;
                        sourceRect.Y = 145;
                        sourceRect.Width = 15;
                        sourceRect.Height = 16;
                        Sprite pole = new FlagPoleSprite(game.scene, Vector2.Zero, texture, sourceRect, 0, numberOfFrames, false);
                        return pole;
                    }
                    case spriteType.flag: {
                        sourceRect.X = 191;
                        sourceRect.Y = 322;
                        sourceRect.Width =16;
                        sourceRect.Height = 16;
                        Sprite flag = new FlagSprite(game.scene, Vector2.Zero, texture, sourceRect, 0, numberOfFrames, false);
                        return flag;
                   }

                    default:
                    {
                        return null;
                    }
                }
        }