Ejemplo n.º 1
0
    public void BeginHand(int hand, byte[] arrHand)
    {
        byte[] newHand = CLZF.Compress(arrHand);

        Debug.Log("Begin Hand:" + hand + " from " + arrHand.Length + " to " + newHand.Length);

        CmdBeginHand(hand, newHand);
    }
    public static int Compress_s(IntPtr l)
    {
        int result;

        try
        {
            byte[] inputBytes;
            LuaObject.checkArray <byte>(l, 1, out inputBytes);
            byte[] a = CLZF.Compress(inputBytes);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, a);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Ejemplo n.º 3
0
        void OnGUI()
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUIEx.ObjectField <TextAsset>(ref assetToCompress, false);
            GUI.enabled = assetToCompress != null;
            if (GUILayout.Button("Compress"))
            {
                string src = AssetDatabase.GetAssetPath(assetToCompress);
                string dst = StringUtil.InsertSuffix(src, "_compress");
                dst = AssetDatabase.GenerateUniqueAssetPath(dst);

                byte[]     compressed = CLZF.Compress(assetToCompress.bytes);
                FileStream os         = new FileStream(dst, FileMode.CreateNew);
                os.Write(compressed, 0, compressed.Length);
                os.Close();
                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
            }
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;
            EditorGUILayout.BeginHorizontal();
            EditorGUIEx.ObjectField <TextAsset>(ref assetToDecompress, false);
            GUI.enabled = assetToDecompress != null;
            if (GUILayout.Button("Decompress"))
            {
                string src = AssetDatabase.GetAssetPath(assetToDecompress);
                string dst = StringUtil.InsertSuffix(src, "_decompress");
                dst = AssetDatabase.GenerateUniqueAssetPath(dst);

                byte[]     decompressed = CLZF.Decompress(assetToCompress.bytes);
                FileStream os           = new FileStream(dst, FileMode.CreateNew);
                os.Write(decompressed, 0, decompressed.Length);
                os.Close();
                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
            }
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;
        }
Ejemplo n.º 4
0
    public void SetLeapHand(int hand, byte[] arrHand)
    {
        byte[] newHand = CLZF.Compress(arrHand);

        CmdSetLeapHand(hand, newHand);
    }