示例#1
0
        void addStartMap()
        {
            view.MapSize = new Point(level.Map.Length, level.Map[0].Length);

            var viewMessages = new List <AddElementWidgetMessage>();

            for (var y = 0; y < level.Map.Length; y++)
            {
                for (var x = 0; x < level.Map[y].Length; x++)
                {
                    var point       = new Point(x, y);
                    var elementType = level.Get(point);
                    var viewMessage = new AddElementWidgetMessage()
                    {
                        To         = point,
                        Type       = elementType,
                        resourceId = elements.GetTextureId(elementType)
                    };

                    viewMessages.Add(viewMessage);
                }
            }

            addElementsHandler(viewMessages.ToArray());
        }
示例#2
0
        void addElementsHandler(AddElementMessage[] addMessages)
        {
            var viewMessages = new List <AddElementWidgetMessage>();

            foreach (var message in addMessages)
            {
                var viewMessage = AddElementWidgetMessage.FromBase(message, elements.GetTextureId(message.Type));
                viewMessages.Add(viewMessage);
            }

            view.AddElements(viewMessages.ToArray());
        }