示例#1
0
        public override void Populate()
        {
            var          txtFileLines = File.ReadAllLines(Install.GetPath("misc.txt"));
            var          typeNames    = txtFileLines[1].Split(Separators);
            TileCategory category     = null;

            for (int i = 2; i < txtFileLines.Length; i++)
            {
                var infos = txtFileLines[i].Split('\t');

                if (infos[1] == "0")
                {
                    category      = new TileCategory(Int32.Parse(infos[2]));
                    category.Name = infos.Last();
                    Categories.Add(category);
                }
                var style = new TileStyle();
                category.AddStyle(style);
                style.Name  = infos.Last();
                style.Index = Int32.Parse(infos[1]);
                for (int j = 3; j < typeNames.Length - 2; j++)
                {
                    if (infos[j] != "0")
                    {
                        var tile = new TileMisc {
                            Id = short.Parse(infos[j])
                        };
                        style.AddTile(tile);
                    }
                }
            }
            TilesCategorySDKModule.Supp.PositionCheck(Categories);
        }
示例#2
0
        public override void Populate()
        {
            var txtFileLines = File.ReadAllLines(Install.GetPath("floors.txt"));
            var typeNames    = txtFileLines[1].Split(Separators);

            for (int i = 2; i < txtFileLines.Length; i++)
            {
                var infos    = txtFileLines[i].Split('\t');
                var category = new TileCategory();
                category.Name = infos.Last();

                var style = new TileStyle();
                category.AddStyle(style);

                for (int j = 1; j < typeNames.Length - 2; j++)
                {
                    if (infos[j] != "0")
                    {
                        var tile = new TileFloor {
                            Id = short.Parse(infos[j])
                        };
                        style.AddTile(tile);
                        tile.ChangeFloorPosition(j);
                    }
                }
                Categories.Add(category);
            }
        }
示例#3
0
        public override void Populate()
        {
            var txtFileLines = File.ReadAllLines(DataManager.Location.LocalPath + "doors.txt");
            var typeNames    = txtFileLines[1].Split(Separators);

            for (int i = 2; i < txtFileLines.Length; i++)
            {
                var infos    = txtFileLines[i].Split('\t');
                var category = new TileCategory();
                category.Name = infos.Last();

                var style = new TileStyle();
                category.AddStyle(style);

                for (int j = 1; j < typeNames.Length - 2; j++)
                {
                    if (infos[j] != "0")
                    {
                        var tile = new TileDoor {
                            Id = uint.Parse(infos[j])
                        };
                        style.List.Add(tile);
                    }
                }
                Categories.Add(category);
            }
            TilesCategorySDKModule.Supp.PositionCheck(Categories);
        }
示例#4
0
        public override void Populate()
        {
            var          txtFileLines = File.ReadAllLines(DataManager.Location.LocalPath + "roofs.txt");
            var          typeNames    = txtFileLines[1].Split(Separators);
            TileCategory category     = null;

            for (int i = 2; i < txtFileLines.Length; i++)
            {
                var infos = txtFileLines[i].Split('\t');

                if (infos[1] == "0")
                {
                    category = new TileCategory(Int32.Parse(infos[2]), TypeTile.Roofs)
                    {
                        Name = infos.Last()
                    };
                    Categories.Add(category);
                }
                var style = new TileStyle();
                category.AddStyle(style);
                style.Name = infos.Last();
                style.Id   = Int32.Parse(infos[1]);
                for (int j = 3; j < typeNames.Length - 3; j++)
                {
                    if (infos[j] != "0")
                    {
                        var tile = new TileRoof {
                            Id = uint.Parse(infos[j])
                        };
                        style.AddTile(tile);
                        tile.Position = (j - 2);
                    }
                }
            }
        }
示例#5
0
 public Tile(TileStyle style, int[] mapPos, Nullable<Direction> dir, Nullable<Direction> secondDir)
     : this(style,
     (style == TileStyle.FLAT) ? "Images/Textures/snowFlat" : "Images/Textures/snowSlope",
     mapPos, new bool[4] { true, true, true, true }, dir, secondDir)
 {
     passage = GetPassage(style, dir, secondDir);
 }
示例#6
0
 /// <summary>
 /// スタイルの適用
 /// </summary>
 public void ApplyStyle(TileStyle style, bool isVisible)
 {
     if (style != null)
     {
         this.Image.color = style.Color;
     }
     this.RectTransform.gameObject.SetActive(isVisible);
 }
示例#7
0
    public void ApplyTileStyle()
    {
        TileStyle ts = GetTileStyle();

        tileObject.GetComponent <Image>().color          = ts.tileColour;
        tileObject.GetComponentInChildren <Text>().text  = number.ToString();
        tileObject.GetComponentInChildren <Text>().color = ts.tileTextColour;
    }
示例#8
0
    private void ApplyStyleFromHolder(int number)
    {
        TileStyle tileStyle = TileStyleManager.GetTileStyle(number);

        this.tileText.text   = tileStyle.number.ToString();
        this.tileText.color  = tileStyle.textColor;
        this.tileImage.color = tileStyle.tileColor;
    }
示例#9
0
        private TileStyle Selector(TileCategory tileCategory, TileStyle s)
        {
            var style = from sh in tileCategory.List
                        where sh.Name.Split(Separator, StringSplitOptions.RemoveEmptyEntries).Last() == s.Name.Split(Separator, StringSplitOptions.RemoveEmptyEntries).Last()
                        select sh;

            return(style.FirstOrDefault());
        }
示例#10
0
 public GameOptions(
     TileStyle tileStyle = TileStyle.SquareBrackets,
     Difficulty difficulty = Difficulty.Normal,
     MapSize mapSize = MapSize.Medium)
 {
     TileStyle = tileStyle;
     Difficulty = difficulty;
     MapSize = mapSize;
 }
示例#11
0
    public static TileStyle DefaultTileStyle()
    {
        TileStyle tileStyle = new TileStyle();

        tileStyle.tileColour     = defaultColour;
        tileStyle.tileNumber     = "0";
        tileStyle.tileTextColour = defaultColour;
        return(tileStyle);
    }
示例#12
0
        private void ButtonAddStyle_Click(object sender, RoutedEventArgs e)
        {
            var category = DataCategory.SelectedItem as TileCategory;
            var styles   = DataStyle.ItemsSource as List <TileStyle>;
            var st       = new TileStyle();

            category.AddStyle(st);
            DataStyle.Items.Refresh();
        }
示例#13
0
 public Tile(TileStyle style, int[] mapPos, Nullable <Direction> dir, Nullable <Direction> secondDir)
     : this(style,
            (style == TileStyle.FLAT) ? "Images/Textures/snowFlat" : "Images/Textures/snowSlope",
            mapPos, new bool[4] {
     true, true, true, true
 }, dir, secondDir)
 {
     passage = GetPassage(style, dir, secondDir);
 }
示例#14
0
 private TileStyle GetDefaultStyle()
 {
     var style = new TileStyle();
     style.Font.Family = new FontFamily("Tempus Sans ITC");
     style.Font.Size = 40;
     style.Font.Weight = FontWeights.Bold;
     style.Shape.Border = new SolidColorBrush(Colors.Transparent);
     style.Shape.Radius = 4;
     return style;
 }
示例#15
0
 private TileStyle GetDefaultStyle()
 {
     var style = new TileStyle();
     style.Font.Family = new FontFamily("Franklin Gothic Heavy");
     style.Font.Size = 40;
     style.Font.Weight = FontWeights.Bold;
     style.Shape.Border = new SolidColorBrush(Colors.Transparent);
     style.Shape.Radius = 6;
     return style;
 }
示例#16
0
 private TileStyle GetDefaultStyle()
 {
     var style = new TileStyle();
     style.Font.Family = new FontFamily("Yu Gothic UI Semilight");
     style.Font.Size = 40;
     style.Font.Weight = FontWeights.Bold;
     style.Shape.BorderThickness = 6;
     style.Shape.Radius = 50;
     return style;
 }
示例#17
0
    public void SetValue(int value)
    {
        Label.text     = value.ToString();
        Label.fontSize = CalculateFontSize(value);

        TileStyle style = TileStyles.GetStyleForValue(value);

        TileRenderer.material.color = style.Color;
        Label.color = style.TextColor;
    }
示例#18
0
        private bool[] GetPassage(TileStyle style, Nullable <Direction> dir, Nullable <Direction> secondDir)
        {
            bool[] p = new bool[4];

            if (style == TileStyle.FLAT)
            {
                for (int i = 0; i < p.Length; i++)
                {
                    p[i] = true;
                }
            }
            else if (style == TileStyle.SLOPE)
            {
                for (int i = 0; i < p.Length; i++)
                {
                    p[i] = false;
                }
            }
            else if (style == TileStyle.INNER_CORNER)
            {
                for (int i = 0; i < p.Length; i++)
                {
                    p[i] = false;
                }
            }
            else if (style == TileStyle.OUTER_CORNER)
            {
                for (int i = 0; i < p.Length; i++)
                {
                    p[i] = false;
                }
            }
            else if (style == TileStyle.VERTICAL)
            {
                for (int i = 0; i < p.Length; i++)
                {
                    if (i == (int)dir)
                    {
                        p[i] = false;
                    }
                    else
                    {
                        p[i] = true;
                    }
                }
            }
            else if (style == TileStyle.SV_CORNER)
            {
                for (int i = 0; i < p.Length; i++)
                {
                    p[i] = false;
                }
            }
            return(p);
        }
示例#19
0
        public TileSlope(Vector3 pos, Point incline, TileStyle style, Color fill)
            : base(pos, TileCollision.Slope, style, fill)
        {
            if (incline.X < -1 || incline.X > 1 || incline.Y < -1 || incline.Y > 1)
            {
                throw new NotSupportedException();
            }

            Center  = pos + Dimensions / 2;
            Incline = incline;
        }
示例#20
0
        private TileStyle GetDefaultStyle()
        {
            var style = new TileStyle();

            style.Font.Family           = new FontFamily("Yu Gothic UI Semilight");
            style.Font.Size             = 40;
            style.Font.Weight           = FontWeights.Bold;
            style.Shape.BorderThickness = 6;
            style.Shape.Radius          = 50;
            return(style);
        }
示例#21
0
        private TileStyle GetDefaultStyle()
        {
            var style = new TileStyle();

            style.Font.Family  = new FontFamily("Tempus Sans ITC");
            style.Font.Size    = 40;
            style.Font.Weight  = FontWeights.Bold;
            style.Shape.Border = new SolidColorBrush(Colors.Transparent);
            style.Shape.Radius = 4;
            return(style);
        }
示例#22
0
        protected void LoadContextSource()
        {
            for (int z = 0; z < Depth; z++)
            {
                for (int y = 0; y < Height; y++)
                {
                    for (int x = 0; x < Width; x++)
                    {
                        if (Tiles[x, y, z].Sprites == null)
                        {
                            continue;
                        }

                        TileNeighbors hood  = TileNeighbors.None;
                        TileStyle     style = Tiles[x, y, z].Style;

                        if ((GetStyle(x - 1, y - 1, z) & style) != TileStyle.None)
                        {
                            hood = hood | TileNeighbors.TopLeft;
                        }
                        if ((GetStyle(x, y - 1, z) & style) != TileStyle.None)
                        {
                            hood = hood | TileNeighbors.TopCenter;
                        }
                        if ((GetStyle(x + 1, y - 1, z) & style) != TileStyle.None)
                        {
                            hood = hood | TileNeighbors.TopRight;
                        }
                        if ((GetStyle(x - 1, y, z) & style) != TileStyle.None)
                        {
                            hood = hood | TileNeighbors.CenterLeft;
                        }
                        if ((GetStyle(x + 1, y, z) & style) != TileStyle.None)
                        {
                            hood = hood | TileNeighbors.CenterRight;
                        }
                        if ((GetStyle(x - 1, y + 1, z) & style) != TileStyle.None)
                        {
                            hood = hood | TileNeighbors.BottomLeft;
                        }
                        if ((GetStyle(x, y + 1, z) & style) != TileStyle.None)
                        {
                            hood = hood | TileNeighbors.BottomCenter;
                        }
                        if ((GetStyle(x + 1, y + 1, z) & style) != TileStyle.None)
                        {
                            hood = hood | TileNeighbors.BottomRight;
                        }

                        Tiles[x, y, z].LoadContextualSource(hood);
                    }
                }
            }
        }
示例#23
0
        private TileStyle GetDefaultStyle()
        {
            var style = new TileStyle();

            style.Font.Family  = new FontFamily("Franklin Gothic Heavy");
            style.Font.Size    = 40;
            style.Font.Weight  = FontWeights.Bold;
            style.Shape.Border = new SolidColorBrush(Colors.Transparent);
            style.Shape.Radius = 6;
            return(style);
        }
示例#24
0
 /// <summary>
 ///		The copy constructor.
 /// </summary>
 private MTileSettings(MTileSettings tileSettingsIn)
     : this()
 {
     XSize     = tileSettingsIn.XSize;
     YSize     = tileSettingsIn.YSize;
     XOffset   = tileSettingsIn.XOffset;
     YOffset   = tileSettingsIn.YOffset;
     XPadding  = tileSettingsIn.XPadding;
     YPadding  = tileSettingsIn.YPadding;
     Extension = tileSettingsIn.Extension;
     Style     = tileSettingsIn.Style;
 }
示例#25
0
        public Tile(Vector3 pos, TileCollision coll, TileStyle style, Color fill)
        {
            Position = pos;
            MapX     = GetArrayXY(pos.X);
            MapY     = GetArrayXY(pos.Y);
            MapZ     = GetArrayXY(pos.Z);

            Collision = coll;
            Style     = style;
            Sprites   = new Subtile[DIVS, DIVS, DIVS];
            Fill      = fill;
        }
示例#26
0
        private void FullEmptyCategoriesTxTChecked(IEnumerable <TileCategory> list, IEnumerable <ItemData> datalist, TileCategory tileCategory)
        {
            var style = new TileStyle();

            foreach (ItemData itemData in datalist)
            {
                Tile tile   = null;
                int  number = itemData.Id;

                var tiles = from cat in list
                            let t = cat.FindTile(number)
                                    where t != null
                                    select t;
                tile = tiles.FirstOrDefault();
                if (tile == null)
                {
                    string name = string.Format("{0}-{1}", tileCategory.Name,
                                                itemData.Name.Replace(tileCategory.Name, "").Split(separator2,
                                                                                                   StringSplitOptions
                                                                                                   .
                                                                                                   RemoveEmptyEntries)
                                                .FirstOrDefault());

                    if (string.IsNullOrEmpty(style.Name) || style.Name != name)
                    {
                        if (style.Tiles.Count > 0 && tileCategory.FindStyleByName(style.Name) == null)
                        {
                            tileCategory.AddStyle(style);
                        }


                        var st2 = tileCategory.FindStyleByName(name);
                        if (st2 == null)
                        {
                            style = new TileStyle {
                                Name = name
                            }
                        }
                        ;
                        else
                        {
                            style = st2;
                        }
                    }
                    style.AddTile(new Tile()
                    {
                        Id = number, Name = itemData.Name
                    });
                }
            }
            tileCategory.AddStyle(style);
        }
示例#27
0
        public GameObject Create(TileStyle tileStyle)
        {
            var tile     = GameObject.CreatePrimitive(PrimitiveType.Cube);
            var tileSize = tileStyle.Size;

            tile.transform.localScale = new Vector3(tileSize, tileSize, tileSize);
            var renderer  = tile.GetComponent <Renderer>();
            var materials = tileStyle.MaterialNames.Select(Resources.Load <Material>).ToArray();

            renderer.materials = materials;

            return(tile);
        }
示例#28
0
    private TileStyle GetTileStyle()
    {
        if (IsEmpty())
        {
            return(TileStyle.DefaultTileStyle());
        }
        if (number > TileStylesHandler.MaxTile)
        {
            return(tileStylesHandler.tileStyles[CalculateTileStyleIndexNumber(TileStylesHandler.MaxTile)]);
        }

        return(tileStylesHandler.tileStyles[CalculateTileStyleIndexNumber(number)]);
    }
示例#29
0
        /// <summary>
        /// Sets the tile's style based on the user's choice.
        /// </summary>
        /// <param name="style"></param>
        /// <returns>The string representing the user's chosen style.</returns>
        private string GenerateStyle(TileStyle style)
        {
            switch (style)
            {
            case TileStyle.CurlyBraces: return("{ }");

            case TileStyle.Parentheses: return("( )");

            case TileStyle.SquareBrackets: return("[ ]");

            default: return("[ ]");
            }
        }
示例#30
0
    public static TileStyle GetTileStyle(int number)
    {
        TileStyle result = null;

        foreach (var tileStyle in instance.tileStyles)
        {
            if (number == tileStyle.number)
            {
                result = tileStyle;
            }
        }
        return(result);
    }
示例#31
0
        private void AddTiles_Click_1(object sender, RoutedEventArgs e)
        {
            var media = SuperGridTiles.DataGridCategories as System.Windows.Media.Visual;

            if (media == null)
            {
                return;
            }
            var foundList = Globals.Helpers.FindElementsOfType(media, typeof(DataGrid));

            if (foundList == null)
            {
                return;
            }

            List <DataGrid> dataList = foundList.OfType <DataGrid>().Select(frameworkElement => frameworkElement).ToList();

            media = null;
            if (dataList.Count == 0)
            {
                return;
            }
            TileStyle style = null;
            var       found = false;

            foreach (var dataGrid in dataList)
            {
                foreach (TileStyle obj in dataGrid.SelectedItems.OfType <TileStyle>())
                {
                    style = obj as TileStyle;
                    found = true;
                }
                if (found)
                {
                    break;
                }
            }
            if (style == null)
            {
                return;
            }
            foreach (var tile in Globals.Globals.SdkTiles.TmpTileList)
            {
                style.AddTile(tile);
            }
            Globals.Globals.SdkTiles.TmpTileList.Clear();
            AllGridRefresh();
        }
示例#32
0
    public void ApplyStyle(NumberTileView tile)
    {
        if (styles == null)
        {
            Initialize();
            Debug.Log("Style Initialized");
        }

        TileStyle style = defaultStyle;

        if (!styles.TryGetValue(tile.number, out style))
        {
            style = defaultStyle;
        }

        ApplyTileStyle(style, tile);
    }
示例#33
0
        public Tile(TileStyle style, string texturePath, int[] mapPos, bool[] passage, Nullable<Direction> dir, Nullable<Direction> secondDir)
        {
            if (style == TileStyle.FLAT){
                this.style = style;
            }else if (style == TileStyle.SLOPE || style == TileStyle.VERTICAL){
                if (dir == null) throw new ArgumentNullException("dir", "Cannot instantiate SLOPE tile without any orientation.");
                this.style = style;
                this.dir = (Direction)dir;
            }else if(style == TileStyle.OUTER_CORNER || style == TileStyle.INNER_CORNER || style == TileStyle.SV_CORNER){
                if (dir == null) throw new ArgumentNullException("dir", "Cannot instantiate *_CORNER tile without any orientation.");
                if (secondDir == null) throw new ArgumentNullException("secondDir", "Cannot instantiate *_CORNER tile without both orientations.");
                this.style = style;
                this.dir = (Direction)dir;
                this.secondDir = (Direction)secondDir;
            }
            this.texturePath = texturePath;
            mapX = mapPos[0];
            mapY = mapPos[1];
            mapZ = mapPos[2];

            this.passage = passage;
        }
示例#34
0
        public Tile(TileStyle style, string texturePath, int[] mapPos, bool[] passage, Nullable <Direction> dir, Nullable <Direction> secondDir)
        {
            if (style == TileStyle.FLAT)
            {
                this.style = style;
            }
            else if (style == TileStyle.SLOPE || style == TileStyle.VERTICAL)
            {
                if (dir == null)
                {
                    throw new ArgumentNullException("dir", "Cannot instantiate SLOPE tile without any orientation.");
                }
                this.style = style;
                this.dir   = (Direction)dir;
            }
            else if (style == TileStyle.OUTER_CORNER || style == TileStyle.INNER_CORNER || style == TileStyle.SV_CORNER)
            {
                if (dir == null)
                {
                    throw new ArgumentNullException("dir", "Cannot instantiate *_CORNER tile without any orientation.");
                }
                if (secondDir == null)
                {
                    throw new ArgumentNullException("secondDir", "Cannot instantiate *_CORNER tile without both orientations.");
                }
                this.style     = style;
                this.dir       = (Direction)dir;
                this.secondDir = (Direction)secondDir;
            }
            this.texturePath = texturePath;
            mapX             = mapPos[0];
            mapY             = mapPos[1];
            mapZ             = mapPos[2];

            this.passage = passage;
        }
        private void SetTileStyle(GeometryDrawing geometryDrawing, TileStyle style = TileStyle.InVisible)
        {
            if (null == geometryDrawing)
            {
                return;
            }
            switch (style)
            {
            case TileStyle.InVisible:
                geometryDrawing.Brush = new SolidColorBrush(Color.FromArgb(0, 255, 255, 0));
                geometryDrawing.Pen   = new Pen(Brushes.Black, 0);
                break;

            case TileStyle.FrameOnly:
                geometryDrawing.Brush = new SolidColorBrush(Color.FromArgb(0, 255, 255, 0));
                geometryDrawing.Pen   = new Pen(Brushes.Black, 0.15);
                break;

            case TileStyle.Highlight:
                geometryDrawing.Brush = new SolidColorBrush(Color.FromArgb(20, 255, 255, 0));
                geometryDrawing.Pen   = new Pen(Brushes.Black, 0.15);
                break;
            }
        }
示例#36
0
        private bool[] GetPassage(TileStyle style, Nullable<Direction> dir, Nullable<Direction> secondDir)
        {
            bool[] p = new bool[4];

            if (style == TileStyle.FLAT){
                for (int i = 0; i < p.Length; i++)
                    p[i] = true;
            }else if (style == TileStyle.SLOPE){
                for (int i = 0; i < p.Length; i++)
                    p[i] = false;
            }else if(style == TileStyle.INNER_CORNER){
                for (int i = 0; i < p.Length; i++)
                    p[i] = false;
            }else if (style == TileStyle.OUTER_CORNER){
                for (int i = 0; i < p.Length; i++)
                    p[i] = false;
            }else if (style == TileStyle.VERTICAL){
                for (int i = 0; i < p.Length; i++)
                    if (i == (int)dir)
                        p[i] = false;
                    else
                        p[i] = true;
            }else if(style == TileStyle.SV_CORNER){
                for (int i = 0; i < p.Length; i++)
                    p[i] = false;
            }
            return p;
        }