Пример #1
0
 public void Init(Scenario s)
 {
     chapterList   = new List <Chapter>(s.chapterObserver);
     previousGroup = null;
     darknessTiles.AddRange(new int[] { 204, 207, 208, 303, 306, 307 });
     //Debug.Log( $"Chapter Manager: {chapterList.Count} Chapters Found" );
 }
Пример #2
0
        void LoadMenu()
        {
            con.open();

            DataTable pram = con.execReturnDataTable("SELECT m.MenuID,t.Content FROM MEN_Menu m left join tblMD_Message t on t.MessageID= m.MenuID  WHERE m.IsVisible= 'True' and ParentMenuID='Mnu' and t.Language='VN' order by m.Priority");

            tblMenu = con.execReturnDataTable("SELECT m.MenuID,t.Content as Text, LOWER(dbo.fn_RemoveToneMark(t.Content)) as Content, m.ParentMenuID FROM MEN_Menu m left join tblMD_Message t on t.MessageID= m.MenuID WHERE m.IsVisible= 'True'  and t.Language='VN'");
            con.close();
            foreach (DataRow item in pram.Rows)
            {
                TileGroup t = new TileGroup {
                    Name = item["MenuID"].ToString(), Text = item["Content"].ToString()
                };
                DataRow[] rows = tblMenu.Select("ParentMenuID = '" + t.Name + "'");
                foreach (DataRow i in rows)
                {
                    TileItem ti = new TileItem {
                        Name = i["MenuID"].ToString(), Text = i["Text"].ToString()
                    };
                    // ti.ItemClick += ti_ItemClick;
                    t.Items.Add(ti);
                }
                lstGroup.Add(t);
                tileControl1.Groups.Add(t);
            }
        }
Пример #3
0
        ///指定ノードが通行可かチェック
        public bool CheckNodeAllow(Vector2Int nodePos)
        {
            TileGroup tg = _map[nodePos.x, nodePos.y].getGroup();

            switch (_unitType)
            {
            case 0:                     /* 船 */
                if (tg != TileGroup.Sea)
                {
                    return(false);
                }
                break;

            case 1:                     /* 車両 */
                if (tg != TileGroup.Ground)
                {
                    return(false);
                }
                break;

            case 2:                     /* 人 */
                if (tg == TileGroup.Sea)
                {
                    return(false);
                }
                break;
            }
            return(true);
        }
Пример #4
0
 private void SelectNode(Model.Internal.Document.DocNode node)
 {
     try
     {
         _selectedNode = node;
         if (_selectedNode == null)
         {
             Find();
         }
         else
         {
             tileDocument.Groups.Clear();
             TileGroup newGroup = new TileGroup();
             foreach (Model.Internal.Document.DocNode n in node.childDocNode)
             {
                 newGroup.Items.Add(CreateTileItem(n));
             }
             tileDocument.Groups.Add(newGroup);
             Refresh_Overview();
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Пример #5
0
 private void Find()
 {
     try
     {
         XPCollection <TIS.Model.Internal.Document.DocNode> dns = new XPCollection <TIS.Model.Internal.Document.DocNode>(Uow);
         //TODO : nog in BL ophalen van wortels (door te querien op ParentDocNode == null en op DocTree)!
         List <TIS.Model.Internal.Document.DocNode> toplvl = new List <TIS.Model.Internal.Document.DocNode>();
         foreach (TIS.Model.Internal.Document.DocNode node in dns)
         {
             if (node.ParentDocNode == null)
             {
                 toplvl.Add(node);
             }
         }
         tileDocument.Groups.Clear();
         TileGroup tg = new TileGroup();
         //tg.Tag = "0";
         tileDocument.Groups.Add(tg);
         foreach (TIS.Model.Internal.Document.DocNode node in toplvl)
         {
             tg.Items.Add(CreateTileItem(node));
         }
         tileControlOverview.Groups.Clear();
         tileControlOverview.Groups.Add(new TileGroup());
         tileControlOverview.Groups[0].Items.Add(_overviewTileItem);
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Пример #6
0
    /// <summary>
    /// Randomly attaches 2 tiles (random anchor/connector) within a given group, tile=previous tile already on board
    /// </summary>
    public void AttachTo(Tile tile, TileGroup tg)
    {
        //anchors = white outer transforms
        //connectors = red inner transforms
        Transform[] anchorPoints = tile.GetChildren("anchor");
        int[]       ra           = GlowEngine.GenerateRandomNumbers(anchorPoints.Length);
        int[]       rc           = GlowEngine.GenerateRandomNumbers(connectorCount);
        bool        success      = false;

        for (int c = 0; c < connectorCount; c++)
        {
            for (int a = 0; a < anchorPoints.Length; a++)              //white anchors on board
            {
                tile.SetAnchor(ra[a]);
                SetConnector(rc[c]);
                AttachTo(tile.currentAnchor);
                Transform[] ap = GetChildren("connector");
                success = !tg.CheckCollisionsWithinGroup(ap);
                if (success)
                {
                    break;
                }
            }
            if (success)
            {
                break;
            }
        }

        if (!success)
        {
            Debug.Log("FAILED TO FIND OPEN TILE LOCATION");
            throw new System.Exception("FAILED TO FIND OPEN TILE LOCATION");
        }
    }
Пример #7
0
    private void CaptureMapGrid()
    {
        int mapHorizontalTiles = Mathf.CeilToInt(mapSize.x / tileSize.x);
        int mapVerticalTiles   = Mathf.CeilToInt(mapSize.z / tileSize.z);

        tileList = new List <MapTile>(mapHorizontalTiles * mapVerticalTiles);
        for (int i = 0; i < mapHorizontalTiles; i++)
        {
            for (int j = 0; j < mapVerticalTiles; j++)
            {
                MapTile tile = new MapTile();
                tile.id             = tileList.Count + 1;
                tile.x              = (int)(i * tileSize.x);
                tile.z              = (int)(j * tileSize.z);
                tile.tileSize       = (int)tileSize.x;
                tile.bigAreaSize    = (int)bigCellSize.x;
                tile.middleAreaSize = (int)middleCellSize.x;
                tile.smallAreaSize  = (int)smallCellSize.x;
                tile.portalSize     = (int)portalSize.x;
                tileList.Add(tile);
                CapturePortalGrid(tile);
                CaptureCellGrid(tile, MapItemSize.Big);
                CaptureCellGrid(tile, MapItemSize.Middle);
                CaptureCellGrid(tile, MapItemSize.Small);
            }
        }

        tileGroup = ScriptableObject.CreateInstance <TileGroup>();
        tileGroup.mapHorizontalTiles = mapHorizontalTiles;
        tileGroup.mapVerticalTiles   = mapVerticalTiles;
        tileGroup.tileList           = tileList;
        AssetDatabase.CreateAsset(tileGroup, "Assets/Resources/TileGroup.asset");
        AssetDatabase.SaveAssets();
    }
Пример #8
0
    //タイル情報のテンプレート作成
    static TileObj addTileTlt(String _image, TileGroup _group, TileType _type, int[] _cost)
    {
        TileObj newTile = new TileObj(_type, _group, _cost);

        newTile.tBase = Resources.Load <TileBase>("TileBase/" + _image);
        return(newTile);
    }
 void LoadMenu()
 {
     tblMenu = UIMessage.DBEngine.execReturnDataTable("sp_Menu_Load",
                                                      "@LanguageID", UIMessage.languageID, CommonConst.A_LoginID, UIMessage.userID);
     foreach (DataRow item in tblMenu.Select("ParentMenuID = 'Mnu'"))
     {
         TileGroup t = new TileGroup {
             Name = item["MenuID"].ToString(), Text = item["Name"].ToString()
         };
         DataRow[] rows = tblMenu.Select("ParentMenuID = '" + t.Name + "'");
         foreach (DataRow i in rows)
         {
             if (i["ClassName"] == DBNull.Value || i["ClassName"].ToString().Equals("OK"))
             {
                 continue;
             }
             TileItem ti = new TileItem {
                 Name = i["MenuID"].ToString(), Text = i["Name"].ToString()
             };
             ti.Tag        = i;
             ti.ItemClick += ti_ItemClick;
             t.Items.Add(ti);
         }
         lstGroup.Add(t);
         tileControl1.Groups.Add(t);
     }
 }
Пример #10
0
        static public OldCatanGame Deserialize(string savedGame)
        {
            OldCatanGame game = new OldCatanGame();

            game.Serializing = true;
            Dictionary <string, string> sections = null;

            try
            {
                sections = StaticHelpers.GetSections(savedGame);
                if (sections == null)
                {
                    game.Error = String.Format($"Error parsing the file into sections.\nThere are no sections.  Please load a valid .catangame file.");
                    return(game);
                }
            }
            catch (Exception e)
            {
                game.Error = e.Message;
                return(game);
            }

            StaticHelpers.DeserializeObject <OldCatanGame>(game, sections["View"], false);
            for (int groupCount = 0; groupCount < game.GroupCount; groupCount++)
            {
                TileGroup tg         = new TileGroup();
                string    tgAsString = sections[$"TileGroup {groupCount}"];
                tg.Deserialize(tgAsString, sections, groupCount);
                game.TileGroups.Add(tg);
            }
            game.Serializing = false;
            return(game);
        }
Пример #11
0
        public Lava(AbstractScene scene, int width, int height, Vector2 position) : base(scene.LayerManager.LavaLayer, null, position)
        {
            AddCollisionAgainst("Hero");
            int       spriteSize = 32;
            TileGroup tg         = new TileGroup(32);
            Texture2D tileSet    = Assets.GetTexture("Lava");

            Color[] data = new Color[spriteSize * spriteSize];
            tileSet.GetData(0, new Rectangle(0, 0, spriteSize, spriteSize), data, 0, data.Length);
            for (int i = 0; i < width; i += spriteSize)
            {
                for (int j = 0; j < height; j += spriteSize)
                {
                    tg.AddColorData(data, new Vector2(i, j));
                }
            }
            AddComponent(new Sprite(this, tg.GetTexture(), new Rectangle(0, 0, width, height)));

            HorizontalFriction = 0;
            VerticalFriction   = 0;

            VelocityY = 0.005f;

            HasGravity          = false;
            CheckGridCollisions = false;

            Visible = true;
            Active  = true;

            AddComponent(new BoxCollisionComponent(this, width, height));
            //DEBUG_SHOW_COLLIDER = true;
        }
Пример #12
0
        private void Refresh_Overview()
        {
            try
            {
                Model.Internal.Document.DocNode        node  = _selectedNode;
                List <Model.Internal.Document.DocNode> nodes = new List <Model.Internal.Document.DocNode>();
                while (node != null)
                {
                    nodes.Insert(0, node);
                    node = node.ParentDocNode;
                }
                // maybe : create top lvl item;

                TileGroup newGroup = new TileGroup();
                newGroup.Items.Add(_overviewTileItem);
                foreach (Model.Internal.Document.DocNode n in nodes)
                {
                    newGroup.Items.Add(CreateTileItem(n));
                }
                tileControlOverview.Groups.Clear();
                tileControlOverview.Groups.Add(newGroup);
            }
            catch (Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
    private void OnSceneGUI()
    {
        Handles.color = Color.white;
        PoteniallyVisibleSetData poteniallyVisibleSetData = PoteniallyVisibleSetData.Instance;

        if (poteniallyVisibleSetData != null)
        {
            TileGroup tileGroup = poteniallyVisibleSetData.tileGroup;
            if (tileGroup != null)
            {
                Handles.color = Color.yellow;
                for (int i = 0; i < tileGroup.tileList.Count; i++)
                {
                    MapTile tile         = tileGroup.tileList[i];
                    float   halfTileSize = tile.tileSize / 2;
                    Handles.RectangleHandleCap(0, new Vector3(tile.x + halfTileSize, 0f, tile.z + halfTileSize), Quaternion.Euler(90f, 0f, 0f), halfTileSize, EventType.Repaint);

                    /*for (int j = 0; j < poteniallyVisibleSetData.currentTilePortalMap.Count; j++)
                     * {
                     *  Portal portal = tile.portalList[j];
                     *  float halfPortalSize = tile.portalSize / 2;
                     *  Handles.RectangleHandleCap(0, new Vector3(portal.x + halfPortalSize, 0f, portal.z + halfPortalSize), Quaternion.Euler(90f, 0f, 0f), halfPortalSize, EventType.Repaint);
                     * }*/
                }

                Handles.color = Color.green;
                foreach (Rect item in poteniallyVisibleSetData.currentTilePortalMap.Keys)
                {
                    float halfPortalSize = poteniallyVisibleSetData.currentMapTile.portalSize / 2;
                    Handles.RectangleHandleCap(0, new Vector3(item.x + halfPortalSize, 0f, item.y + halfPortalSize), Quaternion.Euler(90f, 0f, 0f), halfPortalSize, EventType.Repaint);
                }
            }
        }
    }
Пример #14
0
        protected virtual void AnimateTiles(GameTime time, Rectangle rectangle)
        {
            List <TileGroup> groupsToAnimate = GetGroupsToAnimate(time).ToList();

            if (groupsToAnimate.Count == 0)
            {
                return;
            }

            for (int j = 0; j <= TheMap.Height; j++)
            {
                for (int i = 0; i <= TheMap.Width; i++)
                {
                    int       current = TheMap[i, j];
                    TileGroup group   = groupsToAnimate.FirstOrDefault(x => x.Tiles.Contains(current));

                    if (group == null)
                    {
                        continue;
                    }
                    if (group.AnimationType == AnimationType.None)
                    {
                        continue;
                    }

                    int nextTile = current;

                    switch (group.AnimationType)
                    {
                    case AnimationType.Loop:
                        int index = group.Tiles.IndexOf(current);
                        if (index + 1 >= group.Tiles.Count)
                        {
                            index = 0;
                        }
                        else
                        {
                            index++;
                        }

                        nextTile = group.Tiles[index];
                        break;

                    case AnimationType.Random:
                        while (nextTile == current)
                        {
                            nextTile = group.Tiles[Random.Next(group.Tiles.Count)];
                        }

                        break;
                    }

                    if (group.AnimateChance == 100 || Random.Next(100) < group.AnimateChance)
                    {
                        TheMap[i, j] = nextTile;
                    }
                }
            }
        }
Пример #15
0
 public void WfSetGroupApperance(TileGroup currentGroup)
 {
     currentGroup.TextAreaAppearance.HotTracking.BorderColor = Color.FromArgb(58, 58, 58);
     currentGroup.Appearance.HotTracking.BorderColor         = Color.FromArgb(58, 58, 58);
     currentGroup.Appearance.HotTracking.BackColor           = Color.FromArgb(30, 30, 30);
     currentGroup.Appearance.HotTracking.BackGradientStyle   = GradientStyle.None;
     currentGroup.Appearance.Normal.BackColor         = Color.FromArgb(30, 30, 30);
     currentGroup.Appearance.Normal.BackGradientStyle = GradientStyle.None;
 }
Пример #16
0
 public void UpdateTileGroupLayer(TileGroup tileGroup)
 {
     if (!tileGroup.IsScored) {
         if (bucketsManager.ColorToLayer.ContainsKey(tileGroup.Color)) {
             tileGroup.SetLayer(Globals.Instance.BucketLayersToTileLayers[bucketsManager.ColorToLayer[tileGroup.Color]]);
         } else {
             tileGroup.SetLayer(Globals.Layers.TILE_NULL);
         }
     }
 }
Пример #17
0
        //Coloca titulo nos grupos da TileList com base no nome do subgrupo
        protected void RadTileList1_OnTileDataBound(object sender, TileListEventArgs e)
        {
            string    subgrupo  = DataBinder.GetPropertyValue(e.Tile.DataItem, "subgrupo", null);
            TileGroup currGroup = (sender as RadTileList).GetTileGroupByName(subgrupo);

            if (currGroup != null && currGroup.Title == string.Empty)
            {
                currGroup.Title = subgrupo;
            }
        }
 public void InitializePVSData()
 {
     tileGroup = GameObject.Instantiate(Resources.Load("TileGroup")) as TileGroup;
     for (int i = 0; i < tileGroup.tileList.Count; i++)
     {
         MapTile tile = tileGroup.tileList[i];
         Rect    rect = new Rect(tile.x, tile.z, tile.tileSize, tile.tileSize);
         tileList.Add(rect);
     }
 }
Пример #19
0
    public void SetState(ChapterState chapterState)
    {
        tokenTriggerQueue = chapterState.tokenTriggerQueue;

        var groups = FindObjectOfType <TileManager>().GetAllTileGroups();

        previousGroup = (from tg in groups
                         where tg.GUID == chapterState.previousGroupGUID
                         select tg).First();
    }
Пример #20
0
    public List <TileGroup> MakeGroups()
    {
        if (Groups == null)
        {
            Groups = new List <TileGroup>();
        }
        Groups = TileGroup.GetGroupsFromTiles(GetTileList());

        return(Groups);
    }
Пример #21
0
    public static TileGroup CreateRandomGroup(Chapter c)
    {
        TileGroup tg = new TileGroup(c.GUID);

        tg.startPosition = (-1000f).ToVector3();
        tg.isExplored    = false;

        tg.BuildRandomFromChapter(c);
        return(tg);
    }
Пример #22
0
    //指定位置が指定領域かチェック(sizeマス分チェック)(true:オープン/false:クローズ)
    public bool chkOpenSea(Vector2Int Pos, int size, TileGroup type)
    {
        bool[,] clist = new bool[size * 2 + 1, size *2 + 1]; //チェック用配列
        bool rets = true;

        for (int i = 0; i < size; i++)
        {
            List <Vector2Int> ret = new List <Vector2Int>();
            if (i == 0)
            {
                ret.Add(Pos);
                if (tileMap[Pos.x, Pos.y].getGroup() == type)
                {
                    //自マス+周囲マスを有効にする。
                    clist[size, size] = true;
                    foreach (var ttl in tileRing(Pos, 1))
                    {
                        clist[ttl.x - Pos.x + size, ttl.y - Pos.y + size] = true;
                    }
                }
                else
                {
                    clist[size, size] = false;
                }
            }
            else
            {
                ret = tileRing(Pos, i);
                foreach (var tl in ret)
                {
                    if (clist[tl.x - Pos.x + size, tl.y - Pos.y + size] == true)
                    {
                        if (tileMap[tl.x, tl.y].getGroup() == type)
                        {
                            foreach (var ttl in tileRing(tl, 1))
                            {
                                clist[ttl.x - Pos.x + size, ttl.y - Pos.y + size] = true;
                            }
                        }
                        else
                        {
                            clist[tl.x - Pos.x + size, tl.y - Pos.y + size] = false;
                        }
                    }
                }
            }
            rets = ret.Any(tl => clist[tl.x - Pos.x + size, tl.y - Pos.y + size] == true);
            if (!rets)
            {
                break;
            }
        }
        return(rets);
    }
Пример #23
0
        public static bool IsGroup(DrawableTile tile, TileGroup group)
        {
            var type = tile?.Tile.Type ?? null;

            if (getGroup(type) == group)
            {
                return(true);
            }

            return(false);
        }
Пример #24
0
    public void ParseTiles(Lisp.Parser parser)
    {
        isNew = false;
        int d = parser.Depth;

        while (parser.Parse() && parser.Depth >= d)
        {
            if (parser.Depth == d && parser.Type != Parser.LispType.START_LIST)
            {
                Console.WriteLine("non-cons type in list...");
                continue;
            }

            if (parser.Depth == d + 1)
            {
                if (parser.Type != Parser.LispType.SYMBOL)
                {
                    throw new Exception("Expected symbol in list element");
                }
                switch (parser.SymbolValue)
                {
                case "properties":
                    SkipList(parser);
                    break;

                case "tilegroup":
                    TileGroup tilegroup = new TileGroup();
                    tilegroup.Parse(parser);
                    TileGroups.Add(tilegroup);
                    break;

                case "tile":
                    Tile tile = new Tile();
                    tile.Parse(parser);

                    while (tile.ID >= Tiles.Count)
                    {
                        Tiles.Add(null);
                    }
                    Tiles[tile.ID] = tile;
                    break;

                case "tiles":
                    ParseMoreTiles(parser);
                    isNew = true;
                    break;

                default:
                    throw new Exception("Unexpected listentry: " +
                                        parser.SymbolValue);
                }
            }
        }
    }
    public Room(Transform _parent, GameObject _floor, TileGroup _tiles, int _scale, int _id)
    {
        parent = _parent;
        floor  = _floor;
        tiles  = _tiles;

        scale = _scale;
        id    = _id;

        CalculateCenter();
    }
Пример #26
0
    private void FloodFill()
    {
        // Use a stack instead of recursion
        Stack <Tile> stack = new Stack <Tile>();

        for (int x = 0; x < Width; x++)
        {
            for (int y = 0; y < Height; y++)
            {
                Tile t = Tiles[x, y];

                //Tile already flood filled, skip
                if (t.FloodFilled)
                {
                    continue;
                }

                // Land
                if (t.Collidable)
                {
                    TileGroup group = new TileGroup();
                    group.Type = TileGroupType.Land;
                    stack.Push(t);

                    while (stack.Count > 0)
                    {
                        FloodFill(stack.Pop(), ref group, ref stack);
                    }

                    if (group.Tiles.Count > 0)
                    {
                        Lands.Add(group);
                    }
                }
                // Water
                else
                {
                    TileGroup group = new TileGroup();
                    group.Type = TileGroupType.Water;
                    stack.Push(t);

                    while (stack.Count > 0)
                    {
                        FloodFill(stack.Pop(), ref group, ref stack);
                    }

                    if (group.Tiles.Count > 0)
                    {
                        Waters.Add(group);
                    }
                }
            }
        }
    }
Пример #27
0
        public static TileNotification TileNotificationForQuotes(
            ICollection <StockQuote> quotes)
        {
            var nameSubgroup   = new TileSubgroup();
            var upDownSubgroup = new TileSubgroup();
            int count          = 3;

            foreach (var quote in quotes)
            {
                nameSubgroup.Children.Add(CreateNameTextForQuote(quote));
                upDownSubgroup.Children.Add(CreateArrowTextForQuote(quote));
                count--;
                if (count == 0)
                {
                    break;
                }
            }

            var group = new TileGroup();

            group.Children.Add(nameSubgroup);
            group.Children.Add(upDownSubgroup);

            var content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Content = new TileBindingContentAdaptive()
                        {
                            Children =
                            {
                                group
                            }
                        }
                    },
                    TileWide = new TileBinding()
                    {
                        Content = new TileBindingContentAdaptive()
                        {
                            Children =
                            {
                                group
                            }
                        }
                    }
                }
            };

            var doc = content.GetXml();

            return(new TileNotification(doc));
        }
        private void AddToGroup(SampleItem sample, TileGroup group)
        {
            var tile = new TileView()
            {
                Text  = sample.Name,
                Image = Properties.Resources.C1_WaterMark,
                Tag   = sample
            };

            tile.Click += (s, e) => _sideBar.SelectSample(sample);
            group.Tiles.Add(tile);
        }
Пример #29
0
    private void FloodFill()
    {
        Stack <Tile> stack = new Stack <Tile> ();

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                Tile t = tiles [x, y];

                // If the tile has already been flood filled, skip
                if (t.isFloodFilled)
                {
                    continue;
                }

                // Land check
                if (t.isCollidable)
                {
                    TileGroup group = new TileGroup();
                    group.type = TileGroupType.Land;
                    stack.Push(t);

                    while (stack.Count > 0)
                    {
                        FloodFill(stack.Pop(), ref group, ref stack);
                    }

                    if (group.tiles.Count > 0)
                    {
                        lands.Add(group);
                    }
                }
                // Water check
                else
                {
                    TileGroup group = new TileGroup();
                    group.type = TileGroupType.Water;
                    stack.Push(t);

                    while (stack.Count > 0)
                    {
                        FloodFill(stack.Pop(), ref group, ref stack);
                    }

                    if (group.tiles.Count > 0)
                    {
                        waters.Add(group);
                    }
                }
            }
        }
    }
Пример #30
0
    public void OpenBottom()
    {
        var levelEnterPos = levelEnter.transform.position - new Vector3(0, 0.5f, 0);

        bottomTiles = new TileGroup(GetComponentsInChildren <Tilemap>());
        bottomTiles.SetBounds(
            (int)(levelEnterPos.x - 2),
            (int)levelEnterPos.y,
            (int)(levelEnterPos.x + 2),
            (int)levelEnterPos.y
            );
        bottomTiles.Clear();
    }
Пример #31
0
        private List <TileGroup> CreateTileGroups()
        {
            var groupList = new List <TileGroup>();

            var solidGr = new TileGroup(x =>
                                        x.TileData.Type == TileType.Solid, "solid");

            var liquidGr = new TileGroup(x =>
                                         x.TileData.Type == TileType.Liquid, "liquid");

            groupList.Add(solidGr);
            groupList.Add(liquidGr);
            return(groupList);
        }
Пример #32
0
        protected override void ONCREATE()
        {
            list = BUS.getdata();
            TileGroup group = new TileGroup();

            foreach (var i in list)
            {
                //process, convert byte[] from database to Image
                Image img = Image.FromStream(new MemoryStream(i.images));
                img.Tag = i.maphong;
                //Create tileitem and information
                TileItem item = new TileItem();
                item.ItemSize = TileItemSize.Wide;
                item.Image = img;
                item.Text = i.maphong;
                item.ImageScaleMode = TileItemImageScaleMode.Stretch;
                imageSlider1.Images.Add(img);
                item.ItemClick += (o, e) =>
                {
                    int index = group.Items.IndexOf(e.Item);
                    imageSlider1.SetCurrentImageIndex(index);
                    Global.ID = list[index].maphong;
                };
                item.ItemDoubleClick += (o, e) =>
                {
                    this.mainlayout.Controls.Clear();
                    AddControl<UCRoomSwitch>(mainlayout);
                    radio.SelectedIndex = 1;
                    (new CustomItem.Navigation.TransitionChild(this.mainlayout)).Start();
                    //this.GoTo<UCRoomSwitch>();
                };

                imageSlider1.MouseClick += (o, e) =>
                {

                    int index = imageSlider1.GetCurrentImageIndex();
                    tileControl1.SelectedItem = group.Items[index];
                    Global.ID = list[index].maphong;
                };

                group.Items.Add(item);
            }
            tileControl1.Groups.Add(group);
            if (group.Items.Count > 0)
            {
                tileControl1.SelectedItem = group.Items[0];
                Global.ID = list[0].maphong;
            }
        }
Пример #33
0
        private TileGroup AddAppGroup(IAppGroup appGroup)
        {
            if (!DicTileGroups.ContainsKey(appGroup.Id))
            {
                var tileGroup2 = new TileGroup
                {
                    Name = appGroup.Name,
                    Tag = appGroup.Id
                };
                tileControl1.Groups.Add(tileGroup2);

                DicTileGroups.Add(appGroup.Id, tileGroup2);
            }

            return DicTileGroups[appGroup.Id];
        }
Пример #34
0
		public static ScopeType TileGroupToScopeType (TileGroup group)
		{
			switch (group) {

			case TileGroup.Application:
				return ScopeType.Applications;

			case TileGroup.Calendar:
				return ScopeType.Calendar;

			case TileGroup.Contact:
				return ScopeType.Contacts;

			// This TileGroup exists but does not seem to be used
			// case TileGroup.Folder:
			case TileGroup.Documents:
				return ScopeType.Documents;

			case TileGroup.Conversations:
				return ScopeType.Conversations;

			case TileGroup.Image:
				return ScopeType.Images;

			case TileGroup.Audio:
				return ScopeType.Media;
				
			case TileGroup.Video:
				return ScopeType.Media;

			case TileGroup.Folder:
				return ScopeType.Folders;
				
			case TileGroup.Website:
				return ScopeType.Websites;

			case TileGroup.Feed:
				return ScopeType.Feeds;

			case TileGroup.Archive:
				return ScopeType.Archives;
				
			}

			Console.WriteLine ("Error: Could not find ScopeType for Group: {0}",group);
			return ScopeType.Nothing;
		}
        public TileRepository(string filename)
        {
            isSolid[0] = false;

            LoadingScreenForm loadingScreen = new LoadingScreenForm();
            loadingScreen.setSubject("tileset");
            loadingScreen.setMax(100);
            loadingScreen.Show();
            loadingScreen.Refresh();

            if (!File.Exists(filename)) throw new ArgumentException("Tile file not found");

            String basePath = System.IO.Path.GetDirectoryName(filename);

            tileset = new TileSet();
            tileset.Parse(filename);

            // append a TileGroup (misc) with all tiles that are not yet in a TileGroup
            TileGroup miscTiles = new TileGroup();
            foreach (Tile tile in tileset.Tiles) {
                if (tile == null) continue;
                bool found = false;
                foreach (TileGroup tileGroup in tileset.TileGroups) {
                    if (tileGroup.Tiles.Contains(tile.ID)) found = true;
                }
                if (found) continue;
                miscTiles.Name = "(misc)";
                miscTiles.Tiles.Add(tile.ID);
            }
            tileset.TileGroups.Add(miscTiles);

            loadingScreen.setMax(tileset.Tiles.Count);

            int progress = 0;
            foreach (Tile tile in tileset.Tiles) {
                progress++;
                if (tile == null) continue;

                addTile(tile, basePath);

                loadingScreen.setProgress(progress);
            }

            loadingScreen.Close();
        }
Пример #36
0
        private void cbTilegroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            currentTilegroup = (TileGroup)cbTilegroup.SelectedItem;

            pbTiles.Invalidate();
        }
Пример #37
0
        void LoadMenu()
        {
            con.open();

            DataTable pram = con.execReturnDataTable("SELECT m.MenuID,t.Content FROM MEN_Menu m left join tblMD_Message t on t.MessageID= m.MenuID  WHERE m.IsVisible= 'True' and ParentMenuID='Mnu' and t.Language='VN' order by m.Priority");
            tblMenu = con.execReturnDataTable("SELECT m.MenuID,t.Content as Text, LOWER(dbo.fn_RemoveToneMark(t.Content)) as Content, m.ParentMenuID FROM MEN_Menu m left join tblMD_Message t on t.MessageID= m.MenuID WHERE m.IsVisible= 'True'  and t.Language='VN'");
            con.close();
            foreach (DataRow item in pram.Rows)
            {
                TileGroup t = new TileGroup { Name = item["MenuID"].ToString(), Text = item["Content"].ToString() };
                DataRow[] rows = tblMenu.Select("ParentMenuID = '" + t.Name + "'");
                foreach (DataRow i in rows)
                {
                    TileItem ti = new TileItem { Name = i["MenuID"].ToString(), Text = i["Text"].ToString() };
                   // ti.ItemClick += ti_ItemClick;
                    t.Items.Add(ti);

                }
                lstGroup.Add(t);
                tileControl1.Groups.Add(t);
            }
        }
Пример #38
0
		public TileGroupInfo (TileGroup group, string name, int rows)
		{
			Group = group;
			Name = name;
			Rows = rows;
		}
Пример #39
0
 private void Find()
 {
     try
     {
         XPCollection<TIS.Model.Internal.Document.DocNode> dns = new XPCollection<TIS.Model.Internal.Document.DocNode>(Uow);
         //TODO : nog in BL ophalen van wortels (door te querien op ParentDocNode == null en op DocTree)!
         List<TIS.Model.Internal.Document.DocNode> toplvl = new List<TIS.Model.Internal.Document.DocNode>();
         foreach (TIS.Model.Internal.Document.DocNode node in dns)
         {
             if(node.ParentDocNode == null)
             toplvl.Add(node);
         }
         tileDocument.Groups.Clear();
         TileGroup tg = new TileGroup();
         //tg.Tag = "0";
         tileDocument.Groups.Add(tg);
         foreach (TIS.Model.Internal.Document.DocNode node in toplvl)
         {
             tg.Items.Add(CreateTileItem(node));
         }
         tileControlOverview.Groups.Clear();
         tileControlOverview.Groups.Add(new TileGroup());
         tileControlOverview.Groups[0].Items.Add(_overviewTileItem);
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Пример #40
0
 private void OnTileGroupComboBoxEntryActivated(object o, EventArgs args)
 {
     if(TileGroupComboBox.Entry.Text == "All") {
         selectedgroup = null;
     } else {
         foreach(TileGroup tilegroup in tileset.TileGroups) {
             if(tilegroup.Name == TileGroupComboBox.Entry.Text) {
                 selectedgroup = tilegroup;
                 break;
             }
         }
     }
     FillTileList();
 }
Пример #41
0
 private void SelectNode(Model.Internal.Document.DocNode node)
 {
     try
     {
         _selectedNode = node;
         if (_selectedNode == null)
         {
             Find();
         }
         else
         {
             tileDocument.Groups.Clear();
             TileGroup newGroup = new TileGroup();
             foreach (Model.Internal.Document.DocNode n in node.childDocNode)
             {
                 newGroup.Items.Add(CreateTileItem(n));
             }
             tileDocument.Groups.Add(newGroup);
             Refresh_Overview();
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Пример #42
0
        private void Refresh_Overview()
        {
            try
            {
                Model.Internal.Document.DocNode node = _selectedNode;
                List<Model.Internal.Document.DocNode> nodes = new List<Model.Internal.Document.DocNode>();
                while (node != null)
                {
                    nodes.Insert(0, node);
                    node = node.ParentDocNode;
                }
                // maybe : create top lvl item;

                TileGroup newGroup = new TileGroup();
                newGroup.Items.Add(_overviewTileItem);
                foreach (Model.Internal.Document.DocNode n in nodes)
                {
                    newGroup.Items.Add(CreateTileItem(n));
                }
                tileControlOverview.Groups.Clear();
                tileControlOverview.Groups.Add(newGroup);
            }
            catch (Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
Пример #43
0
    public void ParseTiles(Lisp.Parser parser)
    {
        isNew = false;
        int d = parser.Depth;
        while(parser.Parse() && parser.Depth >= d) {
            if(parser.Depth == d && parser.Type != Parser.LispType.START_LIST) {
                Console.WriteLine("non-cons type in list...");
                continue;
            }

            if(parser.Depth == d+1) {
                if(parser.Type != Parser.LispType.SYMBOL) {
                    throw new Exception("Expected symbol in list element");
                }
                switch(parser.SymbolValue) {
                    case "properties":
                        SkipList(parser);
                        break;
                    case "tilegroup":
                        TileGroup tilegroup = new TileGroup();
                        tilegroup.Parse(parser);
                        TileGroups.Add(tilegroup);
                        break;
                    case "tile":
                        Tile tile = new Tile();
                        tile.Parse(parser);

                        while(tile.ID >= Tiles.Count)
                            Tiles.Add(null);
                        Tiles[tile.ID] = tile;
                        break;
                    case "tiles":
            ParseMoreTiles(parser);
            isNew = true;
                        break;
                   default:
                        throw new Exception("Unexpected listentry: " +
                                parser.SymbolValue);
                }
            }
        }
    }
Пример #44
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        TitleLabel titleLabel = new TitleLabel
        {
            StyleName = "title",
            HorizontalCenter = 0,
            Top = 20
        };
        AddChild(titleLabel);

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
                        {
                            "Cursor Demo", 
                            "Created with eDriven.Gui",
                            //"Author: Danko Kozar",
                            "Cursor packages are loaded dynamically",
                            "You can set the priority to each cursor operation"
                        },
            Callback = delegate(string line) { titleLabel.Text = line; }
        }
        .Start();

        var buttonStyles = new Hashtable
                                      {
                                          {"cursor", "pointer"}
                                      };
        #region VBox

        var vbox = new VGroup
                        {
                            HorizontalCenter = 0,
                            VerticalCenter = 0,
                            Gap = 10
                        };
        AddChild(vbox);

        #endregion

        vbox.AddChild(new Label { Text = "Load cursor package:" });

        #region HBox

        var hbox = new HGroup();
        /*hbox.Click += delegate(Event e)
        {
            var me = (MouseEvent)e;
            if (me.Target is Button)
                AudioPlayerMapper.GetDefault().PlaySound("button_click");
        };*/
        vbox.AddChild(hbox);

        #endregion

        #region Cursor package 1

        var btnCursor1 = new Button
        {
            Text = "Load cursor package 1",
            Icon = (Texture)Resources.Load("Icons/drive_disk"),
            FocusEnabled = false,
            SkinClass = typeof(ImageButtonSkin),
            Styles = buttonStyles,
            MinWidth = 200, 
            MinHeight = 120,
            ToggleMode = true,
            Selected = true
        };
        hbox.AddChild(btnCursor1);

        #endregion

        #region Cursor package 2

        var btnCursor2 = new Button
        {
            Text = "Load cursor package 2",
            Icon = (Texture)Resources.Load("Icons/drive_disk"),
            FocusEnabled = false,
            SkinClass = typeof(ImageButtonSkin),
            Styles = buttonStyles,
            MinWidth = 200,
            MinHeight = 120,
            ToggleMode = true,
            Selected = false
        };
        hbox.AddChild(btnCursor2);

        // button 1 press
        btnCursor1.Click += delegate
        {
            if (_selectedButton != 0)
                AudioPlayerMapper.GetDefault().PlaySound("button_click");

            _selectedButton = 0;
            DeferManager.Instance.Defer(delegate
            {
                btnCursor1.Selected = _selectedButton == 0;
                btnCursor2.Selected = _selectedButton == 1;
                CursorManager.Instance.LoadPackage("Cursors/antialiased-classic/package");
            }, 1);
        };

        // button 2 press
        btnCursor2.Click += delegate
        {
            if (_selectedButton != 1)
                AudioPlayerMapper.GetDefault().PlaySound("button_click");

            _selectedButton = 1;
            DeferManager.Instance.Defer(delegate
            {
                btnCursor1.Selected = _selectedButton == 0;
                btnCursor2.Selected = _selectedButton == 1;
                CursorManager.Instance.LoadPackage("Cursors/blueglass-vista/package");
            }, 1);
        };
        
        #endregion

        #region Spacer

        vbox.AddChild(new Spacer {Height = 30});

        #endregion

        vbox.AddChild(new Label { Text = "Hover cursor over buttons:" });

        TileGroup tileGroup = new TileGroup { PercentWidth = 100, RequestedRowCount = 2 };
        vbox.AddChild(tileGroup);

        #region Crosshair

        var btnCrosshair = new Button
                                  {
                                      Text = "Crosshair",
                                      Icon = (Texture)Resources.Load("Icons/star"),
                                      SkinClass = typeof(ImageButtonSkin),
                                      FocusEnabled = false,
                                      Styles = new Hashtable { { "cursor", "crosshair" } },
                                      MinWidth = 200,
                                      MinHeight = 120
                                  };
        tileGroup.AddChild(btnCrosshair);

        #endregion

        #region Move

        var btnMove = new Button
        {
            Text = "Move",
            Icon = (Texture)Resources.Load("Icons/star"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false,
            Styles = new Hashtable { { "cursor", "move" } },
            MinWidth = 200,
            MinHeight = 120
        };
        tileGroup.AddChild(btnMove);

        #endregion

        #region Help

        var btnHelp = new Button
        {
            Text = "Help",
            Icon = (Texture)Resources.Load("Icons/star"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false,
            Styles = new Hashtable { { "cursor", "help" } },
            MinWidth = 200,
            MinHeight = 120
        };
        tileGroup.AddChild(btnHelp);

        #endregion

        #region E-Resize

        var btnEResize = new Button
        {
            Text = "E-Resize",
            Icon = (Texture)Resources.Load("Icons/star"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false,
            Styles = new Hashtable { { "cursor", "e-resize" } },
            MinWidth = 200,
            MinHeight = 120
        };
        tileGroup.AddChild(btnEResize);

        #endregion

        #region Spacer

        vbox.AddChild(new Spacer { Height = 30 });

        #endregion

        vbox.AddChild(new Label { Text = "Click the button for a high-priority cursor:" });

        #region Cursor progress

        var btnProgress = new Button
        {
            Text = "Show progress cursor (5 sec)",
            Icon = (Texture)Resources.Load("Icons/star"),
            SkinClass = typeof(ImageButtonSkin),
            FocusEnabled = false,
            Styles = buttonStyles,
            MinWidth = 200,
            MinHeight = 120,
            PercentWidth = 100
        };
        btnProgress.Press += new eDriven.Core.Events.EventHandler(delegate
        {
            int id = CursorManager.Instance.SetCursor("wait", 1);
            var t = new Timer(5, 1);
            t.Complete += delegate
            {
                t.Dispose();
                CursorManager.Instance.RemoveCursor(id);
            };
            t.Start();
        });
        vbox.AddChild(btnProgress);

        #endregion
    }
Пример #45
0
	private void FloodFill(Tile tile, ref TileGroup tiles, ref Stack<Tile> stack)
	{
		// Validate
		if (tile == null)
			return;
		if (tile.FloodFilled) 
			return;
		if (tiles.Type == TileGroupType.Land && !tile.Collidable)
			return;
		if (tiles.Type == TileGroupType.Water && tile.Collidable)
			return;

		// Add to TileGroup
		tiles.Tiles.Add (tile);
		tile.FloodFilled = true;

		// floodfill into neighbors
		Tile t = GetTop (tile);
		if (t != null && !t.FloodFilled && tile.Collidable == t.Collidable)
			stack.Push (t);
		t = GetBottom (tile);
		if (t != null && !t.FloodFilled && tile.Collidable == t.Collidable)
			stack.Push (t);
		t = GetLeft (tile);
		if (t != null && !t.FloodFilled && tile.Collidable == t.Collidable)
			stack.Push (t);
		t = GetRight (tile);
		if (t != null && !t.FloodFilled && tile.Collidable == t.Collidable)
			stack.Push (t);
	}
Пример #46
0
 public TileGroupMatchResults(TileGroup group, float patternMatch, float colourMatch)
 {
     this.group = group;
     this.patternMatch = patternMatch;
     this.colourMatch = colourMatch;
 }
Пример #47
0
		private bool GroupInScope (TileGroup group)
		{
			ScopeType scopetype = Utils.TileGroupToScopeType (group);
			return (scope & scopetype) == scopetype;
		}
Пример #48
0
 void LoadMenu()
 {
     tblMenu = UIMessage.DBEngine.execReturnDataTable("sp_Menu_Load",
             "@LanguageID", UIMessage.languageID, CommonConst.A_LoginID, UIMessage.userID);
     foreach (DataRow item in tblMenu.Select("ParentMenuID = 'Mnu'"))
     {
         TileGroup t = new TileGroup { Name = item["MenuID"].ToString(), Text = item["Name"].ToString() };
         DataRow[] rows = tblMenu.Select("ParentMenuID = '" + t.Name + "'");
         foreach (DataRow i in rows)
         {
             if (i["ClassName"] == DBNull.Value || i["ClassName"].ToString().Equals("OK"))
                 continue;
             TileItem ti = new TileItem { Name = i["MenuID"].ToString(), Text = i["Name"].ToString() };
             ti.Tag = i;
             ti.ItemClick += ti_ItemClick;
             t.Items.Add(ti);
         }
         lstGroup.Add(t);
         tileControl1.Groups.Add(t);
     }
 }
Пример #49
0
	public BoardTile[] GetPropertiesInGroup(TileGroup grp){
		// create a property list
		List<BoardTile> properties = new List<BoardTile>();
		// iterate over our properties, and find all that match the criteria
		for(int i=0;i<ownedProperties.Count;i++){
			if(ownedProperties[i].tileGroup == grp){
				properties.Add(ownedProperties[i]);
			}
		}
		
		return properties.ToArray();
	}
Пример #50
0
        void RefreshMenu(DataRow[] rows)
        {
            tileControl1.Groups.Clear();
            TileGroup g = new TileGroup();
            if (rows != null && rows.Count()!=0)
            {
                tileControl1.Groups.Add(g);
                foreach (DataRow i in rows)
                {
                    TileItem ti = new TileItem { Name = i["MenuID"].ToString(), Text = i["Name"].ToString() };
                   ti.ItemClick += ti_ItemClick;
                   ti.Tag = i;
                    g.Items.Add(ti);

                }
                tileControl1.SelectedItem = g.Items[0];
                g.Items[0].AppearanceItem.Selected.BackColor = Color.Red;
                g.Items[0].AppearanceItem.Selected.BackColor2 = Color.Orange;
                g.Items[0].AppearanceItem.Selected.BorderColor = Color.White;
            }
        }
Пример #51
0
    void BuildTileGroup(Tile tile, TileGroup tileGroup)
    {
        if (tile.TileGroup != null) {
            return;
        } else {
            tileGroup.AddTile(tile);

            List<Tile> adjacentTilesList = tileGridManager.GetAdjacentTiles(tile);
            foreach (Tile adjacentTile in adjacentTilesList) {
                if (adjacentTile.Color == tile.Color) {
                    BuildTileGroup(adjacentTile, tileGroup);
                }
            }
        }
    }
Пример #52
0
        private static void AddSimilarTileToGroup(Tile tile, TileGroup group, int key)
        {
            // Check if key already exists
            bool hasKey = group.ContainsKey(key);
            while (hasKey == true)
            {
                int otherTileIndex = group[key];
                //Tile otherTile = allSubImageTiles[otherTileIndex];
                Tile otherTile = allSubImageTiles.ElementAt(otherTileIndex);
                Tuple<float, float> results = otherTile.GetMatches(tile);
                float patternMatch = results.Item1;
                float colourMatch = results.Item2;

                bool areIdentical = Tile.IdenticalTo(patternMatch, colourMatch);
                if (areIdentical == true)
                {
                    Duplicates++;
                    return;
                }

                key++;
                hasKey = group.ContainsKey(key);
            }

            int tileIndex = tile.Index;
            group.AddSimilar(key, tileIndex);
        }
Пример #53
0
	private void FloodFill()
	{
		// Use a stack instead of recursion
		Stack<Tile> stack = new Stack<Tile>();
		
		for (int x = 0; x < Width; x++) {
			for (int y = 0; y < Height; y++) {
				
				Tile t = Tiles[x,y];

				//Tile already flood filled, skip
				if (t.FloodFilled) continue;

				// Land
				if (t.Collidable)   
				{
					TileGroup group = new TileGroup();
					group.Type = TileGroupType.Land;
					stack.Push(t);
					
					while(stack.Count > 0) {
						FloodFill(stack.Pop(), ref group, ref stack);
					}
					
					if (group.Tiles.Count > 0)
						Lands.Add (group);
				}
				// Water
				else {				
					TileGroup group = new TileGroup();
					group.Type = TileGroupType.Water;
					stack.Push(t);
					
					while(stack.Count > 0)	{
						FloodFill(stack.Pop(), ref group, ref stack);
					}
					
					if (group.Tiles.Count > 0)
						Waters.Add (group);
				}
			}
		}
	}