public ObjectProfile expandProfile()
        {
            ObjectProfile profile = new ObjectProfile();

            profile.name  = name;
            profile.ID    = ID;
            profile.image = image;
            profile.texture.SetData(texture);
            return(profile);
        }
        static public TransferableObjectProfile compressProfile(ObjectProfile givenProfile)
        {
            TransferableObjectProfile profile = new TransferableObjectProfile();

            profile.ID    = givenProfile.ID;
            profile.name  = givenProfile.name;
            profile.image = givenProfile.image;
            givenProfile.texture.GetData(profile.texture);

            return(profile);
        }
示例#3
0
        static public Token checkProfilesToken(Texture2D checkedObject)
        {
            Token toBeReturned;

            foreach (ObjectProfile profile in profiles)
            {
                if (profile.texture == checkedObject)
                {
                    toBeReturned = new Token(profile);
                    return(toBeReturned);
                }
            }
            ObjectProfile toBeAdded = new ObjectProfile();

            toBeAdded.ID      = profiles.Count;
            toBeAdded.texture = checkedObject;
            profiles.Add(toBeAdded);
            toBeReturned = new Token(toBeAdded);
            return(toBeReturned);
        }
示例#4
0
        static public Object checkProfiles(Texture2D checkedObject)
        {
            Object toBeReturned;

            foreach (ObjectProfile profile in profiles)
            {
                if (profile.texture == checkedObject)
                {
                    toBeReturned = new Object(profile);
                    return(toBeReturned);
                }
            }
            ObjectProfile toBeAdded = new ObjectProfile();

            toBeAdded.ID      = profiles.Count;
            toBeAdded.texture = checkedObject;
            toBeAdded.image   = game.paintImage;
            toBeAdded.name    = game.selectedPaintName;
            profiles.Add(toBeAdded);
            toBeReturned = new Object(toBeAdded);
            return(toBeReturned);
        }
示例#5
0
文件: Map.cs 项目: PuddingEarl/MTEB
 public void updateMap(MouseState currentMouse, MouseState pastMouse)
 {
     if (currentMouse.LeftButton == ButtonState.Pressed && pastMouse.LeftButton == ButtonState.Released)
     {
         foreach (List <Tile> givenList in XAxis) // a double foreach, oh boy we gonna learn events.
         {
             foreach (Tile tile in givenList)
             {
                 if (tile.checkMouse(currentMouse.Position.ToVector2(), tileSize, camera))
                 {
                     if (game.paintTool != null)
                     {
                         if (game.currentPaintLayer != -1)
                         {
                             Object toBeAdded = ObjectProfile.checkProfiles(game.paintTool);
                             toBeAdded.paintLayer = game.currentPaintLayer;
                             toBeAdded.zLayer     = game.currentZLayer;
                             tile.presentObjects.Add(toBeAdded);
                         }
                         else
                         {
                             Token toBeAdded = ObjectProfile.checkProfilesToken(game.paintTool);
                             toBeAdded.paintLayer = -1;
                             toBeAdded.zLayer     = game.currentZLayer;
                             tile.presentTokens.Add(toBeAdded);
                         }
                     }
                     else if (game.currentPaintLayer == -1)
                     {
                         if (tile.presentTokens.Count > 0)
                         {
                             selectedObject = tile.presentTokens.Last();
                             originTile     = tile;
                         }
                     }
                     else
                     {
                         selectedTile = tile;
                         if (game.tileEditForm != null)
                         {
                             game.tileEditForm.updateTable(selectedTile, game.currentPaintLayer, game.currentZLayer);
                         }
                     }
                 }
             }
         }
     }
     else if (currentMouse.LeftButton == ButtonState.Pressed && pastMouse.LeftButton == ButtonState.Pressed && selectedObject != null)
     {
         foreach (List <Tile> givenList in XAxis)
         {
             foreach (Tile tile in givenList)
             {
                 if (tile.checkMouse(currentMouse.Position.ToVector2(), tileSize, camera))
                 {
                     targetTile = tile;
                 }
             }
         }
     }
     else if (currentMouse.LeftButton == ButtonState.Released && pastMouse.LeftButton == ButtonState.Pressed && selectedObject != null)
     {
         if (targetTile != originTile)
         {
             if (originTile.presentObjects.Contains(selectedObject))
             {
                 targetTile.presentObjects.Add(selectedObject);
                 originTile.presentObjects.Remove(selectedObject);
             }
             else if (originTile.presentTokens.Contains(selectedObject))
             {
                 targetTile.presentTokens.Add((Token)selectedObject);
                 originTile.presentTokens.Remove((Token)selectedObject);
             }
         }
         selectedObject = null;
         targetTile     = null;
         originTile     = null;
     }
     else if (currentMouse.RightButton == ButtonState.Pressed)
     {
         camera.area.X -= currentMouse.Position.X - pastMouse.Position.X;
         camera.area.Y -= currentMouse.Position.Y - pastMouse.Position.Y;
     }
 }
示例#6
0
文件: Token.cs 项目: PuddingEarl/MTEB
 public Token(ObjectProfile profile) : base(profile)
 {
 }
示例#7
0
 public Object(ObjectProfile profile)
 {
     ID   = profile.ID;
     name = profile.name;
 }