Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        hoodFrame = Environment.LoadAnimatedTexture(Hash.TGIRHash(0xCCC30000, 0x00000000, 0x856DDBAC, 0x499DB772), 4);
        var MenuStrings1 = new STRFile(Environment.GetAsset(Hash.TGIRHash(0x00000087, 0x00000000, 0x53545223, Hash.GroupHash("Neighborhood"))));
        var MenuStrings2 = new STRFile(Environment.GetAsset(Hash.TGIRHash(0x00000086, 0x00000000, 0x53545223, Hash.GroupHash("Neighborhood"))));

        Panel.mainPanel = new Panel();
        var menuBackground = Environment.LoadUITexture(Hash.TGIRHash(0xCCC9AF70, 0x00000000, 0x856DDBAC, 0x499DB772));

        //var menuBackground = Environment.LoadUITexture(new SU2.Utils.GroupEntryRef(0xCCC9AF70, 0x00000000, 0x856DDBAC, 0x499DB772));
        Panel.mainPanel.MakePlainBackground(new Color(0.007843138f, 0.1647059f, 0.2784314f));
        Panel.mainPanel.AddImage(menuBackground, Vector2.zero);
        var hoodChooser = Environment.LoadUITexture(Hash.TGIRHash(0xCCC30135, 0x00000000, 0x856DDBAC, 0x499DB772));

        Panel.mainPanel.AddImage(hoodChooser, Vector2.zero);
        Panel.mainPanel.AddImage(Environment.LoadUITexture(Hash.TGIRHash(0xCCC30138, 0x00000000, 0x856DDBAC, 0x499DB772)), new Vector2(-3.5f, -253.5f));
        var tleft  = TopLeftSprite[Random.Range(0, TopLeftSprite.Count)];
        var bright = BotRightSprite[Random.Range(0, BotRightSprite.Count)];

        Panel.mainPanel.AddImage(Environment.LoadUITexture(tleft), new Vector2(-208.1f, 194.3f));
        Panel.mainPanel.AddImage(Environment.LoadUITexture(bright), new Vector2(213.6f, -125.5f));
        var exitButton = Environment.LoadAnimatedTexture(Hash.TGIRHash(0xCCC30095, 0x00000000, 0x856DDBAC, 0x499DB772), 4);

        Panel.mainPanel.AddImage(Environment.LoadUITexture(Hash.TGIRHash(0xCCC29090, 0x00000000, 0x856DDBAC, 0x499DB772)), new Vector2(-5f, -250.5f));
        var exitButt = Panel.mainPanel.AddButton(exitButton, new Vector2(-5f, -250.5f), true, MenuStrings2.GetString(2));

        exitButt.onPress += Environment.QuitGame;
        Panel.mainPanel.AddImage(Environment.LoadUITexture(Hash.TGIRHash(0xCCC30080, 0x00000000, 0x856DDBAC, 0x499DB772)), new Vector2(0f, 226.4f));
        var spinBob = Environment.LoadAnimatedTexture(Hash.TGIRHash(0xCCC30200, 0x00000000, 0x856DDBAC, 0x499DB772));

        Panel.mainPanel.AddImage(spinBob[0], new Vector2(-4.6f, 285f));

        //File.WriteAllBytes(Environment.config.output, stre);
        var nhoodText = Panel.mainPanel.AddText(MenuStrings1.GetString(0), new Vector2(0f, 112f), 16);

        nhoodText.alignment = TextAnchor.MiddleCenter;
        nhoodText.fontSize  = 20;
        nhoodText.color     = new Color(0.6313726f, 0.6666667f, 0.9529412f);
        var nextButton = Environment.LoadAnimatedTexture(Hash.TGIRHash(0xCCC30115, 0x00000000, 0x856DDBAC, 0x499DB772), 4);

        nextHButton = Panel.mainPanel.AddButton(nextButton, new Vector2(288f, 51f), true, "");
        var prevButton = Environment.LoadAnimatedTexture(Hash.TGIRHash(0xCCC30110, 0x00000000, 0x856DDBAC, 0x499DB772), 4);

        previousHButton          = Panel.mainPanel.AddButton(prevButton, new Vector2(-288f, 51f), true, "");
        nextHButton.onPress     += NextPage;
        previousHButton.onPress += PrevPage;
        CalculateButtons();
        var xOff = 175f;

        for (var i = 0; i < 3; i++)
        {
            var hh = Panel.mainPanel.CreateHoodFramePanel(new Vector2(-xOff + (xOff * i), 29.3f), Environment.hoods[i]);
            hoodFrames.Add(hh);
        }
    }
Exemple #2
0
    public Neighborhood(string folder)
    {
        nhoodFolder = Path.GetFullPath(folder).TrimEnd(Path.DirectorySeparatorChar);
        var packagePath = Path.Combine(folder, Path.GetFileName(nhoodFolder) + "_Neighborhood.package");

        package = new DBPFFile(packagePath);
        var stringsFile = package.GetItemByFullID(Hash.TGIRHash(0x00000001, 0x00000000, 0x43545353, package.groupID));

        if (stringsFile != null)
        {
            var ds = new STRFile(stringsFile);
            name = ds.GetString(0);
            desc = ds.GetString(1);
        }
        var pictureFile = Path.Combine(folder, Path.GetFileName(nhoodFolder) + "_Neighborhood.png");
        var hoodTexture = Environment.LoadUITexture(Hash.TGIRHash(0xCCC30155, 0x00000000, 0x856DDBAC, 0x499DB772));

        if (File.Exists(pictureFile))
        {
            hoodTexture = Environment.LoadUITexture(File.ReadAllBytes(pictureFile));
        }
        thumbnail = hoodTexture;
        largePic  = hoodTexture;
    }