コード例 #1
0
    public void SetImage()
    {
        UIWindowSelectionListImage select = new UIWindowSelectionListImage(SelectImage, SELECT_IMAGE.Translate());

        select.AddItem("{NONE}", "", true);

        Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >();

        traits.Add(CommonStringKeys.SOURCE.Translate(), new string[] { CommonStringKeys.FILE.Translate() });
        string relativePath = new FileInfo(Path.GetDirectoryName(Game.Get().quest.qd.questPath)).FullName;

        foreach (string s in Directory.GetFiles(relativePath, "*.png", SearchOption.AllDirectories))
        {
            select.AddItem(s.Substring(relativePath.Length + 1), traits);
        }
        foreach (string s in Directory.GetFiles(relativePath, "*.jpg", SearchOption.AllDirectories))
        {
            select.AddItem(s.Substring(relativePath.Length + 1), traits);
        }
        foreach (ImageData imageData in Game.Get().cd.Values <ImageData>())
        {
            select.AddItem(imageData);
        }
        select.ExcludeExpansions();
        select.Draw();
    }
コード例 #2
0
    public void Image()
    {
        if (puzzleComponent.puzzleClass.Equals("code"))
        {
            UIWindowSelectionList selectType = new UIWindowSelectionList(SelectImage, SELECT_IMAGE.Translate());
            selectType.AddItem("{NUMBERS}", "");
            selectType.AddItem(new StringKey("val", "SYMBOL").Translate(), "symbol");
            selectType.AddItem(new StringKey("val", "ELEMENT").Translate(), "element");
            selectType.Draw();
            return;
        }

        UIWindowSelectionListImage select = new UIWindowSelectionListImage(SelectImage, SELECT_IMAGE.Translate());

        Dictionary <string, IEnumerable <string> > traits = new Dictionary <string, IEnumerable <string> >();

        traits.Add(new StringKey("val", "SOURCE").Translate(), new string[] { new StringKey("val", "FILE").Translate() });
        string relativePath = new FileInfo(Path.GetDirectoryName(Game.Get().quest.qd.questPath)).FullName;

        foreach (string s in Directory.GetFiles(relativePath, "*.png", SearchOption.AllDirectories))
        {
            select.AddItem(s.Substring(relativePath.Length + 1), traits);
        }
        foreach (string s in Directory.GetFiles(relativePath, "*.jpg", SearchOption.AllDirectories))
        {
            select.AddItem(s.Substring(relativePath.Length + 1), traits);
        }
        foreach (KeyValuePair <string, PuzzleData> kv in Game.Get().cd.puzzles)
        {
            select.AddItem(kv.Value);
        }
        select.ExcludeExpansions();
        select.Draw();
    }
コード例 #3
0
    public void Type()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();
        UIWindowSelectionListTraits select = new UIWindowSelectionListImage(SelectType, new StringKey("val", "SELECT", CommonStringKeys.TOKEN));

        select.AddItem(CommonStringKeys.NONE.Translate(), "{NONE}", true);

        foreach (TokenData kv in game.cd.Values <TokenData>())
        {
            select.AddItem(kv);
        }
        select.ExcludeExpansions();
        select.Draw();
    }
コード例 #4
0
    public void ChangeTileSide()
    {
        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }
        Game game = Game.Get();
        UIWindowSelectionListTraits select = new UIWindowSelectionListImage(SelectTileSide, new StringKey("val", "SELECT", CommonStringKeys.TILE));

        // Work out what sides are used
        HashSet <string> usedSides = new HashSet <string>();

        foreach (KeyValuePair <string, QuestData.QuestComponent> kv in game.quest.qd.components)
        {
            QuestData.Tile t = kv.Value as QuestData.Tile;
            if (t != null)
            {
                usedSides.Add(t.tileSideName);
                usedSides.Add(game.cd.Get <TileSideData>(t.tileSideName).reverse);
            }
        }

        foreach (KeyValuePair <string, TileSideData> kv in game.cd.GetAll <TileSideData>())
        {
            if (usedSides.Contains(kv.Key))
            {
                select.AddItem(kv.Value, new Color(0.4f, 0.4f, 1));
            }
            else
            {
                select.AddItem(kv.Value);
            }
        }
        select.ExcludeExpansions();
        select.Draw();
    }