Example #1
0
        //---------------------------------------------------
        //-------------------Constructors--------------------
        //---------------------------------------------------
        public TileModel(string name,Point location, Size size, GorgonLibrary.Graphics.Sprite sprite, bool isCrossable, bool isTexture)
        {
            this.surfaceRect = new Rectangle(location, new Size(32,32));

            this.OriginalSize = size;
            this.GorgonSprite = sprite;
            this.IsCrossable = isCrossable;
            this.IsTexture = isTexture;
            this.Name = name;
        }
Example #2
0
        public DisplayObject(GorgonLibrary.Graphics.Sprite gorgonSprite, Point location, CoronaObject coronaObjectParent)
        {
            this.surfaceRect = new Rectangle();
            this.GorgonSprite = gorgonSprite;

            this.surfaceRect.Size = new Size(GorgonSprite.Image.Width, GorgonSprite.Image.Height) ;

            this.surfaceRect.Location = location;
            InitialRect = this.surfaceRect;

            this.Name = "";
            this.type = "IMAGE";

            CurrentFrame = 0;
            Alpha = 1.0F;

            this.GradientColor = new GradientColor();
            this.CoronaObjectParent = coronaObjectParent;
        }
Example #3
0
 public override bool KeyDown(GorgonLibrary.InputDevices.KeyboardInputEventArgs e)
 {
     if (_name.KeyDown(e))
     {
         _currentSystem.Name = _name.Text;
         return true;
     }
     return false;
 }
Example #4
0
 public override bool KeyDown(GorgonLibrary.InputDevices.KeyboardInputEventArgs e)
 {
     if (_showingText)
     {
         if ((e.Key == GorgonLibrary.InputDevices.KeyboardKeys.Enter || e.Key == GorgonLibrary.InputDevices.KeyboardKeys.Return) && !string.IsNullOrEmpty(_nameTextBox.Text))
         {
             _starSystem.Name = _nameTextBox.Text;
             _colonizing = false;
             _showingText = false;
             //Done
             if (Completed != null)
             {
                 Completed();
             }
         }
         _nameTextBox.KeyDown(e);
     }
     else if (e.Key == GorgonLibrary.InputDevices.KeyboardKeys.Enter || e.Key == GorgonLibrary.InputDevices.KeyboardKeys.Return)
     {
         _showingText = true;
         _landingShipPos = _gameMain.ScreenHeight / 2 + 50;
     }
     return true;
 }
Example #5
0
        void Gorgon_Idle(object sender, GorgonLibrary.Graphics.FrameEventArgs e)
        {
            Gorgon.Screen.Clear(Color.Black);
            Gorgon.Screen.BeginDrawing();

            _gameMain.ProcessGame(e.FrameDeltaTime);

            Gorgon.Screen.EndDrawing();
        }
Example #6
0
        public bool IsGorgonImageUsedInTileModels(List<TileModel> modelList, GorgonLibrary.Graphics.Image gorgonImage)
        {
            if (modelList != null)
            {
                for (int i = 0; i < modelList.Count; i++)
                {
                    TileModel model = modelList[i];
                    if (model.GorgonSprite != null)
                    {
                        if (model.GorgonSprite.Image == gorgonImage)
                            return true;
                    }
                }
            }

            return false;
        }
Example #7
0
        public bool IsGorgonImageUsedInEntireTileMap(GorgonLibrary.Graphics.Image gorgonImage)
        {
            bool isUsed = this.IsGorgonImageUsedInTileModels(this.TileModelsTextureUsed,gorgonImage);
            if (isUsed == true)
                return true;

            isUsed = this.IsGorgonImageUsedInTileModels(this.TileModelsObjectsUsed, gorgonImage);
            if (isUsed == true)
                return true;

            List<TileModel> newTextureSequenceModelsUsed = this.getTextureSequenceModelsUsed();
            isUsed = this.IsGorgonImageUsedInTileModels(newTextureSequenceModelsUsed, gorgonImage);
            newTextureSequenceModelsUsed.Clear();
            newTextureSequenceModelsUsed = null;
            if (isUsed == true)
                return true;

            List<TileModel> newObjectSequenceModelsUsed = this.getObjectSequenceModelsUsed();
            isUsed = this.IsGorgonImageUsedInTileModels(newObjectSequenceModelsUsed, gorgonImage);
            newObjectSequenceModelsUsed.Clear();
            newObjectSequenceModelsUsed = null;
            if (isUsed == true)
                return true;

            return false;
        }
Example #8
0
        public bool IsImageUsedByProject(GorgonLibrary.Graphics.Image image,CoronaObject sourceObject)
        {
            if (this.currentProject != null)
            {
                for (int i = 0; i < this.currentProject.Scenes.Count; i++)
                {
                    Scene scene = this.currentProject.Scenes[i];
                    for (int j = 0; j < scene.Layers.Count; j++)
                    {
                        CoronaLayer layer = scene.Layers[j];
                        for (int k = 0; k < layer.CoronaObjects.Count; k++)
                        {
                            bool res = this.IsImageUsedByObject(layer.CoronaObjects[k], image, sourceObject);
                            if (res == true)
                                return true;
                        }

                    }
                }
            }

            return false;
        }
Example #9
0
        public bool IsImageUsedByObject(CoronaObject obj, GorgonLibrary.Graphics.Image image,CoronaObject sourceObject)
        {
            if (obj != null)
            {
                if (obj.isEntity == true)
                {
                    CoronaEntity entity = obj.Entity;
                    for (int l = 0; l < entity.CoronaObjects.Count; l++)
                    {
                        CoronaObject child = entity.CoronaObjects[l];
                        bool res = this.IsImageUsedByObject(child, image, sourceObject);
                        if (res == true)
                            return true;
                    }
                }
                else
                {
                    if (obj == sourceObject) return false;
                    if (obj.DisplayObject != null)
                    {

                        //if (obj.DisplayObject.Type.Equals("IMAGE"))
                        //{
                        //    if (obj == sourceObject) return false;
                        //    else if (obj.DisplayObject.OriginalAssetName.Equals(image.Name))
                        //        return true;
                        //}
                        //else if (obj.DisplayObject.Type.Equals("SPRITE"))
                        //{

                        //}

                        if (obj.DisplayObject.GorgonSprite != null)
                        {
                            if (obj.DisplayObject.GorgonSprite.Image == image)
                                return true;

                        }
                    }
                }
            }

            return false;
        }