コード例 #1
0
 public static int getNextEventID(string sceneName, int mapID)
 {
     if (idDictionary == null)
     {
         IDHandler.LoadIDs();
     }
     if (IDHandler.idDictionary.ContainsKey(sceneName))
     {
         if (IDHandler.idDictionary[sceneName].Exists(id => id.mapID == mapID))
         {
             int tempInt = 1;
             while (IDHandler.idDictionary[sceneName][mapID].eventIDs.Contains(tempInt))
             {
                 ++tempInt;
             }
             IDHandler.idDictionary[sceneName][mapID].eventIDs.Add(tempInt);
             return(tempInt);
         }
         else
         {
             IDHandler.idDictionary[sceneName].Add(new MapIDInfo(mapID));
             IDHandler.idDictionary[sceneName][mapID].eventIDs.Add(1);
             return(1);
         }
     }
     else
     {
         IDHandler.idDictionary.Add(sceneName, new List <MapIDInfo>());
         IDHandler.idDictionary[sceneName].Add(new MapIDInfo(mapID));
         IDHandler.idDictionary[sceneName][mapID].eventIDs.Add(1);
         return(1);
     }
 }
コード例 #2
0
        private void HandleTiledAttributes(GameObject gameObject, XElement goXml, int previousMapID, MetadataSettings previousMetadata)
        {
            // Add the TiledMap component
            TiledMap map = gameObject.AddComponent <TiledMap>();

            try
            {
                map.NumTilesWide      = ImportUtils.GetAttributeAsInt(goXml, "numTilesWide");
                map.NumTilesHigh      = ImportUtils.GetAttributeAsInt(goXml, "numTilesHigh");
                map.TileWidth         = ImportUtils.GetAttributeAsInt(goXml, "tileWidth");
                map.TileHeight        = ImportUtils.GetAttributeAsInt(goXml, "tileHeight");
                map.ExportScale       = ImportUtils.GetAttributeAsFloat(goXml, "exportScale");
                map.MapWidthInPixels  = ImportUtils.GetAttributeAsInt(goXml, "mapWidthInPixels");
                map.MapHeightInPixels = ImportUtils.GetAttributeAsInt(goXml, "mapHeightInPixels");
                if (previousMapID == 0)
                {
                    map.MapID = IDHandler.getNextMapID(EditorApplication.currentScene);
                }
                else
                {
                    map.MapID = previousMapID;
                }
                map.gameObject.AddComponent <MetadataSettings>();
                if (previousMetadata != null)
                {
                    map.gameObject.GetComponent <MetadataSettings>().Copy(previousMetadata);
                }
            }
            catch
            {
                Debug.LogWarning(String.Format("Error adding TiledMap component. Are you using an old version of Tiled2Unity in your Unity project?"));
                GameObject.DestroyImmediate(map);
            }
        }
コード例 #3
0
    public static void SaveIDs()
    {
        if (idDictionary == null)
        {
            IDHandler.LoadIDs();
        }

        FileInfo idFile;

        if ((new FileInfo(idHandlerPath)).Exists)
        {
            // Get file info
            idFile = new FileInfo(idHandlerPath);
            // Remove the hidden attribute of the file
            idFile.Attributes &= ~FileAttributes.Hidden;
        }

        using (Stream stream = File.Open(idHandlerPath, FileMode.Create)) {
            var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            binaryFormatter.Serialize(stream, idDictionary);
        }
        // Hide the file.
        idFile             = new FileInfo(idHandlerPath);
        idFile.Attributes |= FileAttributes.Hidden;
    }
コード例 #4
0
 public void OnDestroy()
 {
     if (Application.isEditor && !EditorApplication.isPlaying)
     {
         IDHandler.removeMapID(EditorApplication.currentScene, this.MapID);
     }
 }
コード例 #5
0
 public Account(SocketAppUser user, Server.LogIn server)
 {
     InitializeComponent();
     scorpServer       = server;
     pictureBox1.Image = user.Avatar;
     metroLabel2.Text  = $"{user.UserName}#{IDHandler.VerifyUserTag(user.Tag)}";
 }
コード例 #6
0
 public UserInfo(SocketAppUser user)
 {
     InitializeComponent();
     User = user;
     pictureBox1.Image = user.Avatar;
     label1.Text       = user.UserName;
     label2.Text       = $"#{IDHandler.VerifyUserTag(user.Tag)}";
 }
コード例 #7
0
 public static void addScene(string sceneName)
 {
     if (idDictionary == null)
     {
         IDHandler.LoadIDs();
     }
     if (idDictionary.ContainsKey(sceneName))
     {
         idDictionary.Add(sceneName, new List <MapIDInfo>());
     }
 }
コード例 #8
0
 public static void removeEventID(string sceneName, int mapId, int targetEventID)
 {
     if (idDictionary == null)
     {
         IDHandler.LoadIDs();
     }
     if (IDHandler.idDictionary.ContainsKey(sceneName) && IDHandler.idDictionary[sceneName].Exists(x => x.mapID == mapId))
     {
         IDHandler.idDictionary[sceneName][mapId].eventIDs.RemoveAll(x => x.Equals(targetEventID));
     }
 }
コード例 #9
0
 public static void removeMapID(string sceneName, int targetMapID)
 {
     if (idDictionary == null)
     {
         IDHandler.LoadIDs();
     }
     if (IDHandler.idDictionary.ContainsKey(sceneName))
     {
         IDHandler.idDictionary[sceneName].RemoveAll(x => x.mapID == targetMapID);
     }
 }
コード例 #10
0
        private MedianCut(Bitmap bmp, WiiPixelFormat texFormat, WiiPaletteFormat palFormat)
        {
            //Set output format
            if (texFormat == WiiPixelFormat.CI4)
            {
                _outFormat = PixelFormat.Format4bppIndexed;
            }
            else if (texFormat == WiiPixelFormat.CI8)
            {
                _outFormat = PixelFormat.Format8bppIndexed;
            }
            else
            {
                throw new ArgumentException("Invalid pixel format.");
            }

            //Set conversion functions
            if (palFormat == WiiPaletteFormat.IA8)
            {
                _idFunc = IA8Handler;
                _idConv = IA8Converter;
            }
            else if (palFormat == WiiPaletteFormat.RGB565)
            {
                _idFunc = RGB565Handler;
                _idConv = RGB565Converter;
            }
            else
            {
                _idFunc = RGB5A3Handler;
                _idConv = RGB5A3Converter;
            }

            //Lock/set source data
            _srcBmp  = bmp;
            _width   = bmp.Width;
            _height  = bmp.Height;
            _size    = _width * _height;
            _srcData = bmp.LockBits(new Rectangle(0, 0, _width, _height), ImageLockMode.ReadOnly,
                                    PixelFormat.Format32bppArgb);
            _srcPixels = (ARGBPixel *)_srcData.Scan0;

            //Create buffers
            _boxes      = (ColorBox *)Marshal.AllocHGlobal(256 * sizeof(ColorBox));
            _groupTable = (ColorEntry **)Marshal.AllocHGlobal(65536 * sizeof(void *));
        }
コード例 #11
0
        private MedianCut(Bitmap bmp, WiiPixelFormat texFormat, WiiPaletteFormat palFormat)
        {
            //Set output format
            if (texFormat == WiiPixelFormat.CI4)
                _outFormat = PixelFormat.Format4bppIndexed;
            else if (texFormat == WiiPixelFormat.CI8)
                _outFormat = PixelFormat.Format8bppIndexed;
            else
                throw new ArgumentException("Invalid pixel format.");

            //Set conversion functions
            if (palFormat == WiiPaletteFormat.IA8)
            {
                _idFunc = IA8Handler;
                _idConv = IA8Converter;
            }
            else if (palFormat == WiiPaletteFormat.RGB565)
            {
                _idFunc = RGB565Handler;
                _idConv = RGB565Converter;
            }
            else
            {
                _idFunc = RGB5A3Handler;
                _idConv = RGB5A3Converter;
            }

            //Lock/set source data
            _srcBmp = bmp;
            _width = bmp.Width;
            _height = bmp.Height;
            _size = _width * _height;
            _srcData = bmp.LockBits(new Rectangle(0, 0, _width, _height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
            _srcPixels = (ARGBPixel*)_srcData.Scan0;

            //Create buffers
            _boxes = (ColorBox*)Marshal.AllocHGlobal(256 * sizeof(ColorBox));
            _groupTable = (ColorEntry**)Marshal.AllocHGlobal(65536 * 4);
        }
コード例 #12
0
 public static int getNextMapID(string sceneName)
 {
     if (idDictionary == null)
     {
         IDHandler.LoadIDs();
     }
     if (IDHandler.idDictionary.ContainsKey(sceneName))
     {
         int tempInt = 1;
         while (IDHandler.idDictionary[sceneName].Exists(id => id.mapID == tempInt))
         {
             ++tempInt;
         }
         IDHandler.idDictionary[sceneName].Add(new MapIDInfo(tempInt));
         Debug.Log(sceneName + " " + tempInt);
         return(tempInt);
     }
     else
     {
         IDHandler.idDictionary.Add(sceneName, new List <MapIDInfo>());
         IDHandler.idDictionary[sceneName].Add(new MapIDInfo(1));
         return(1);
     }
 }
コード例 #13
0
 public FieldIndexKeyHandler(IIndexable4 delegate_)
 {
     _parentIdHandler = new IDHandler();
     _valueHandler    = delegate_;
 }
コード例 #14
0
 //Saving scene in Unity will save this info to file
 static string[] OnWillSaveAssets(string[] paths)
 {
     IDHandler.SaveIDs();
     return(paths);
 }
コード例 #15
0
ファイル: FieldIndexKeyHandler.cs プロジェクト: masroore/db4o
 public FieldIndexKeyHandler(IIndexable4 delegate_)
 {
     _parentIdHandler = new IDHandler();
     _valueHandler = delegate_;
 }