Exemplo n.º 1
0
        public void Send(Cmd4Send cmd)
        {
            ClientSendBuffer.Clear();
            ClientSendBuffer.PutShort(MSG_HEAD);
            byte[] content = cmd.Encode();
            int    len     = content.Length + 2;//+2是cmd的short长度

            ClientSendBuffer.PutInt(len);
            ClientSendBuffer.PutShort(cmd.Cmd);
            ClientSendBuffer.PutBytes(content);
            byte[] bs = ClientSendBuffer.ToArray();

            //Debug.Log("发送长度:"+bs.Length);

            //IoBuffer ib = new IoBuffer(102400);
            //ib.PutBytes(bs);
            //short head = ib.GetShort();
            //int len0 = ib.GetInt();
            //int cmd0 = ib.GetShort();
            //int contentI = ib.GetInt();
            //string contentS = ib.GetString();
            //Debug.Log("head:"+head+" len0:"+len0+" cmd0:"+cmd0+" contentI:"+contentI+" contentS:"+contentS);

            Send(bs);
        }
Exemplo n.º 2
0
    public static void ExportTabConfig()
    {
        TabData[] td = GEditorRoot.GetIns().GetOpenedTabDatas();
        IoBuffer  ib = new IoBuffer();

        ib.PutInt(td.Length);         //长度
        for (int i = 0; i < td.Length; i++)
        {
            ib.PutString(td[i].Name);          //name;
            ib.PutString(td[i].RefName);       //refName;
            ib.PutInt(td[i].Index);            //Index;
            //VLog.I("GEditorDataMgr","ExportTabConfig","i:"+i+" Name:"+td[i].Name+" RefName:"+td[i].RefName+" Index:"+td[i].Index);
        }

        FileHelper.Save(GEditorEnum.EDITOR_DATA_ROOTURL, GEditorEnum.EDITOR_TAB_CONFIG_NAME, ib.ToArray());
    }
Exemplo n.º 3
0
    public static void SaveCheckDic()
    {
        EditorHelper.DeleteFileIfExists(MD5CheckDicPath);

        int num = PathMD5Dic.Count;

        if (num == 0)
        {
            return;
        }

        IoBuffer ib = new IoBuffer(102400);

        ib.PutInt(num);

        foreach (var p in PathMD5Dic)
        {
            ib.PutString(p.Key);
            ib.PutString(p.Value);
        }

        byte[] bs = ib.ToArray();

        //目录不存在就创建
        if (!EditorHelper.BeFolderExist(MD5CheckDicFolderPath))
        {
            EditorHelper.CreateFolder(MD5CheckDicFolderPath);
        }

        FileHelper.WriteBytes2File(MD5CheckDicPath, bs);
    }
Exemplo n.º 4
0
        public void Send(string sessionID, Cmd4Send cmd)
        {
            Debug.Log("服务端向sessionID:" + sessionID + " 发送 cmd:" + cmd.Cmd);

            if (SessionDic.ContainsKey(sessionID))
            {
                ServerSendBuffer.Clear();
                ServerSendBuffer.PutShort(MSG_HEAD);
                byte[] content = cmd.Encode();
                int    len     = content.Length + 2;//+2是cmd的short长度
                ServerSendBuffer.PutInt(len);
                ServerSendBuffer.PutShort(cmd.Cmd);
                ServerSendBuffer.PutBytes(content);
                byte[] bs = ServerSendBuffer.ToArray();
                AsyncSend(SessionDic[sessionID]._SocketPackMgr._Socket, bs);
            }
        }
Exemplo n.º 5
0
        public void Post(short cmd, byte[] bytes, Action <byte[]> callback)
        {
            _Buffer.Clear();

            _Buffer.PutBytes(bytes);

            //NINFO 这个为了帮助server去掉client httpRequest头
            int msgContentLen = _Buffer.GetLength();

            _Buffer.PutInt(msgContentLen);
            byte[] bs = _Buffer.ToArray();

            //Debug.Log("客户端发送len :" + bs.Length+" msgContentLen:"+msgContentLen);

            //for (int i = 0; i < bs.Length; i++)
            //{
            //    Debug.LogError("client send: i:" + i + "--->" + bs[i]);
            //}

            StartCoroutine(Post(bs, callback, false));
        }
Exemplo n.º 6
0
    /// <summary>
    /// 将remote最新的resInfoList保存到下载中目录,等待移动到沙盒位置
    /// </summary>
    private void SaveResInfoList2DownloadingFoler()
    {
        IoBuffer ib = new IoBuffer(102400);

        ib.PutInt(RemoteResInfoDic.Count);

        foreach (var p in RemoteResInfoDic)
        {
            ib.PutString(p.Key);
            ib.PutString(p.Value);
        }
        byte[] bs = ib.ToArray();
        Utils.SB.Append(UnityUtil.PersistentPath);
        Utils.SB.Append(DownloadCachePath);
        Utils.SB.Append("/resInfoList.bytes");
        string savePath = Utils.SB.ToString();

        Utils.ClearSB();
        FileHelper.WriteBytes2File_Create(savePath, bs);
        LogMgr.I("DownloadRes", "SaveResInfoList2DownloadingFoler", "将remote最新的resInfoList保存到下载中目录:" + savePath, BeShowLog);
        SetState(DownloadResState.generateDownloadOverFlagFile);
    }
Exemplo n.º 7
0
    /// <summary>
    /// 处理1个tree的导出
    ///
    /// </summary>
    /// <param name="treeItem">Tree item.</param>
    /// <param name="ioBuffer">Io buffer.</param>
    private static void ProcessOneTreeItem(TreeItem treeItem)
    {
        if (treeItem.BeFolder)
        {
            TreeFolder _treeFolder = treeItem as TreeFolder;
            ioBuffer4TreeCfgExport.PutBool(_treeFolder.BeFolder);       //是否是folder
            ioBuffer4TreeCfgExport.PutString(_treeFolder.Name);         //节点名称
            List <TreeItem> _ItemList = _treeFolder.ItemList;
            ioBuffer4TreeCfgExport.PutInt(_ItemList.Count);             //直接子节点数

            for (int i = 0; i < _ItemList.Count; i++)
            {
                TreeItem item = _ItemList [i];
                ProcessOneTreeItem(item);
            }
        }
        else
        {
            ioBuffer4TreeCfgExport.PutBool(treeItem.BeFolder);           //是否是folder
            ioBuffer4TreeCfgExport.PutString(treeItem.Name);             //节点名称
            ioBuffer4TreeCfgExport.PutString(treeItem.TreeItemID);       //数据索引ID
        }
    }
Exemplo n.º 8
0
    /// <summary>
    /// 版本信息表
    /// </summary>
//	static void CreateVerTable(){
//
//		//[创建版本信息表]----apkVer.bytes---------------------------------------------------------
//		buf.Clear();
//		buf = new IoBuffer();
//		buf.PutInt(1);//apkVer版本号
//		buf.PutBool(true);//是否有apkRes
//		buf.PutBool(false);//是否有apkUpdate
//		buf.PutBool(false);//是否有apkDynamic
//		//buf.PutBool(false);//是否有
//		b = buf.ToArray();
//		FileHelper.WriteBytes2File(EditorHelper.OUTPUT_TABLE_SYSTEM_PATH+"/apkver.bytes",b);
//
//	}

    /// <summary>
    /// 包内资源表
    /// </summary>
//	static void CreateAPKResTable(){
//
//		//配表资源scnInfo0.bytes
//		int id_scnInfo =0;
//		id_scnInfo = ResEnum.GetResIDByTypeAndID(id_scnInfo,ResEnum.RES_TYPE0_BYTES,ResEnum.RES_TYPE1_SCENE,ResEnum.RES_TYPE2_NULL,0);//暂定无类型id为0
//		Debug.Log("id_scnInfo:"+id_scnInfo);
//
//
//		//配表资源mapInfo0.bytes
//		int id_mapInfo =0;
//		id_mapInfo = ResEnum.GetResIDByTypeAndID(id_mapInfo,ResEnum.RES_TYPE0_BYTES,ResEnum.RES_TYPE1_MAP,ResEnum.RES_TYPE2_MAP_INFO,0);//暂定无类型id为0
//		Debug.Log("id_mapInfo:"+id_mapInfo);
//
//		//测试terrain0.n
//		int id_terrain=0;
//		id_terrain = ResEnum.GetResIDByTypeAndID(id_terrain,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_MAP,ResEnum.RES_TYPE2_MAP_TERRAIN,0);//暂定无类型id为0
//
//		//骨骼
//		int id_bone = 0;
//		id_bone = ResEnum.GetResIDByTypeAndID(id_bone,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_BONE,0);//暂定无类型id为0
//
//		int id_eye = 0;
//		id_eye = ResEnum.GetResIDByTypeAndID(id_eye,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_EYES,0);//暂定无类型id为0
//
//		int id_face = 0;
//		id_face = ResEnum.GetResIDByTypeAndID(id_face,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_FACE,0);//暂定无类型id为0
//
//		int id_head = 0;
//		id_head = ResEnum.GetResIDByTypeAndID(id_head,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_HEAD,0);//暂定无类型id为0
//
//		int id_top = 0;
//		id_top = ResEnum.GetResIDByTypeAndID(id_top,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_TOP,0);//暂定无类型id为0
//
//		int id_hands = 0;
//		id_hands = ResEnum.GetResIDByTypeAndID(id_hands,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_HANDS,0);//暂定无类型id为0
//
//		int id_pants = 0;
//		id_pants = ResEnum.GetResIDByTypeAndID(id_pants,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_PANTS,0);//暂定无类型id为0
//
//		int id_shoes = 0;
//		id_shoes = ResEnum.GetResIDByTypeAndID(id_shoes,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_SHOES,0);//暂定无类型id为0
//
//		//材质资源
//		int id_eye_mat = 0;
//		id_eye_mat = ResEnum.GetResIDByTypeAndID(id_eye_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_EYES_MAT,0);//暂定无类型id为0
//
//		int id_face_mat = 0;
//		id_face_mat = ResEnum.GetResIDByTypeAndID(id_face_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_FACE_MAT,0);//暂定无类型id为0
//
//		int id_head_mat = 0;
//		id_head_mat = ResEnum.GetResIDByTypeAndID(id_head_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_HEAD_MAT,0);//暂定无类型id为0
//
//		int id_top_mat = 0;
//		id_top_mat = ResEnum.GetResIDByTypeAndID(id_top_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_TOP_MAT,0);//暂定无类型id为0
//
//		int id_hands_mat = 0;
//		id_hands_mat = ResEnum.GetResIDByTypeAndID(id_hands_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_HANDS_MAT,0);//暂定无类型id为0
//
//		int id_pants_mat = 0;
//		id_pants_mat = ResEnum.GetResIDByTypeAndID(id_pants_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_PANTS_MAT,0);//暂定无类型id为0
//
//		int id_shoes_mat = 0;
//		id_shoes_mat = ResEnum.GetResIDByTypeAndID(id_shoes_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_SHOES_MAT,0);//暂定无类型id为0
//
//		int id_anim_group = 0;
//		id_anim_group = ResEnum.GetResIDByTypeAndID(id_anim_group,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_ANIMGROUP,0);//暂定无类型id为0
//
//		Debug.Log("bone:"+id_bone +
//		          "eyes:"+id_eye+
//		          "face:"+id_face+
//		          "head:"+id_head+
//		          "top:"+id_top+
//		          "hand:"+id_hands+
//		          "pants:"+id_pants+
//		          "shoes:"+id_shoes+
//		          "eyesM:"+id_eye_mat+
//		          "faceM:"+id_face_mat+
//		          "headM:"+id_head_mat+
//		          "topM:"+id_top_mat+
//		          "handM:"+id_hands_mat+
//		          "pantsM:"+id_pants_mat+
//		          "shoeM:"+id_shoes_mat+
//		          "anim_group"+id_anim_group);
//
//
//		//创建包内资源表apkRes.bytes(apk中包含的res)---------------------------------------------------------
//		buf.Clear();
//		buf.PutInt(19);//apkRes中的资源数
//		//加入scnid配表资源
//		//buf.PutInt(id_scnID);//apkRes中存的资源ID
//		buf.PutInt(id_scnInfo);//加入scnInfo配表资源
//		buf.PutInt(id_mapInfo);//加入mapInfo配表资源
//		buf.PutInt(id_terrain);//加入terrain资源
//
//		buf.PutInt(id_bone);
//		buf.PutInt(id_eye);
//		buf.PutInt(id_face);
//		buf.PutInt(id_head);
//		buf.PutInt(id_top);
//		buf.PutInt(id_hands);
//		buf.PutInt(id_pants);
//		buf.PutInt(id_shoes);
//
//		buf.PutInt(id_eye_mat);
//		buf.PutInt(id_face_mat);
//		buf.PutInt(id_head_mat);
//		buf.PutInt(id_top_mat);
//		buf.PutInt(id_hands_mat);
//		buf.PutInt(id_pants_mat);
//		buf.PutInt(id_shoes_mat);
//
//		buf.PutInt(id_anim_group);
//
//		b = buf.ToArray();
//		FileHelper.WriteBytes2File(EditorHelper.OUTPUT_TABLE_SYSTEM_PATH+"/apkres.bytes",b);
//
//	}

    /// <summary>
    /// 资源总表
    /// </summary>
    static void CreateResInfoTable()
    {
//		//配表资源scnInfo0.bytes
//		int id_scnInfo =0;
//		id_scnInfo = ResEnum.GetResIDByTypeAndID(id_scnInfo,ResEnum.RES_TYPE0_BYTES,ResEnum.RES_TYPE1_SCENE,ResEnum.RES_TYPE2_NULL,0);//暂定无类型id为0
//		Debug.Log("id_scnInfo:"+id_scnInfo);
//
//
//		//配表资源mapInfo0.bytes
//		int id_mapInfo =0;
//		id_mapInfo = ResEnum.GetResIDByTypeAndID(id_mapInfo,ResEnum.RES_TYPE0_BYTES,ResEnum.RES_TYPE1_MAP,ResEnum.RES_TYPE2_MAP_INFO,0);//暂定无类型id为0
//		Debug.Log("id_mapInfo:"+id_mapInfo);
//
//		//测试terrain0.n
//		int id_terrain=0;
//		id_terrain = ResEnum.GetResIDByTypeAndID(id_terrain,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_MAP,ResEnum.RES_TYPE2_MAP_TERRAIN,0);//暂定无类型id为0
//
//
//		//骨骼
//		int id_bone = 0;
//		id_bone = ResEnum.GetResIDByTypeAndID(id_bone,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_BONE,0);//暂定无类型id为0
//
//		int id_eye = 0;
//		id_eye = ResEnum.GetResIDByTypeAndID(id_eye,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_EYES,0);//暂定无类型id为0
//
//		int id_face = 0;
//		id_face = ResEnum.GetResIDByTypeAndID(id_face,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_FACE,0);//暂定无类型id为0
//
//		int id_head = 0;
//		id_head = ResEnum.GetResIDByTypeAndID(id_head,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_HEAD,0);//暂定无类型id为0
//
//		int id_top = 0;
//		id_top = ResEnum.GetResIDByTypeAndID(id_top,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_TOP,0);//暂定无类型id为0
//
//		int id_hands = 0;
//		id_hands = ResEnum.GetResIDByTypeAndID(id_hands,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_HANDS,0);//暂定无类型id为0
//
//		int id_pants = 0;
//		id_pants = ResEnum.GetResIDByTypeAndID(id_pants,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_PANTS,0);//暂定无类型id为0
//
//		int id_shoes = 0;
//		id_shoes = ResEnum.GetResIDByTypeAndID(id_shoes,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_SHOES,0);//暂定无类型id为0
//
//		//材质资源
//		int id_eye_mat = 0;
//		id_eye_mat = ResEnum.GetResIDByTypeAndID(id_eye_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_EYES_MAT,0);//暂定无类型id为0
//
//		int id_face_mat = 0;
//		id_face_mat = ResEnum.GetResIDByTypeAndID(id_face_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_FACE_MAT,0);//暂定无类型id为0
//
//		int id_head_mat = 0;
//		id_head_mat = ResEnum.GetResIDByTypeAndID(id_head_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_HEAD_MAT,0);//暂定无类型id为0
//
//		int id_top_mat = 0;
//		id_top_mat = ResEnum.GetResIDByTypeAndID(id_top_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_TOP_MAT,0);//暂定无类型id为0
//
//		int id_hands_mat = 0;
//		id_hands_mat = ResEnum.GetResIDByTypeAndID(id_hands_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_HANDS_MAT,0);//暂定无类型id为0
//
//		int id_pants_mat = 0;
//		id_pants_mat = ResEnum.GetResIDByTypeAndID(id_pants_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_PANTS_MAT,0);//暂定无类型id为0
//
//		int id_shoes_mat = 0;
//		id_shoes_mat = ResEnum.GetResIDByTypeAndID(id_shoes_mat,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_SHOES_MAT,0);//暂定无类型id为0
//
//
//		int id_anim_group = 0;
//		id_anim_group = ResEnum.GetResIDByTypeAndID(id_anim_group,ResEnum.RES_TYPE0_PREFAB,ResEnum.RES_TYPE1_ROLE,ResEnum.RES_TYPE2_ROLE_ANIMGROUP,0);//暂定无类型id为0
//


        //[创建资源总表]---apkresinfo.bytes------------------------------------------------------------------
        buf.Clear();
        buf.PutInt(19);        //资源条数

        //加入scnid配表资源
        //buf.PutInt(id_scnID);//资源ID
        //buf.PutByte((byte)0);//卸载类型
        //buf.PutString("scnid");//资源名
        //buf.PutInt(0);//依赖资源数

        //加入scnInfo配表资源
        buf.PutString("table/scene/scninfo0.bytes"); //资源ID
        buf.PutByte((byte)0);                        //卸载类型
        buf.PutByte((byte)0);                        //打包类型,单独打包  //TODO bytes资源是否是单独打包没什么区别,这个参数对于bytes类型是多余的,bytes和bundle加载走的不同逻辑,加或不加都不会出错
        buf.PutString("scninfo0");                   //资源名
        buf.PutInt(0);                               //依赖资源数   //TODO 需要考虑下还要不要这个依赖资源数

        //加入mapInfo配表资源
        buf.PutString("table/map/mapinfo0.bytes"); //资源ID
        buf.PutByte((byte)0);                      //卸载类型
        buf.PutByte((byte)0);                      //打包类型,单独打包
        buf.PutString("mapinfo0");                 //资源名
        buf.PutInt(0);                             //依赖资源数

        //加入terrain资源
        buf.PutString("res/map/terrain0.n");
        buf.PutByte((byte)0);      //卸载类型
        buf.PutByte((byte)0);      //打包类型,单独打包
        buf.PutString("terrain0"); //资源名
        buf.PutInt(0);             //依赖资源数

        buf.PutString("res/role/female_basebone.n");
        buf.PutByte((byte)0);             //卸载类型
        buf.PutByte((byte)0);             //打包类型,单独打包
        buf.PutString("female_basebone"); //资源名
        buf.PutInt(0);                    //依赖资源数

        buf.PutString("res/role/female_eyes.n");
        buf.PutByte((byte)0);         //卸载类型
        buf.PutByte((byte)1);         //打包类型,多资源打包
        buf.PutString("female_eyes"); //资源名
        buf.PutInt(0);                //依赖资源数

        buf.PutString("res/role/female_face-1.n");
        buf.PutByte((byte)0);           //卸载类型
        buf.PutByte((byte)1);           //打包类型,多资源打包
        buf.PutString("female_face-1"); //资源名
        buf.PutInt(0);                  //依赖资源数

        buf.PutString("res/role/female_hair-1.n");
        buf.PutByte((byte)0);           //卸载类型
        buf.PutByte((byte)1);           //打包类型,多资源打包
        buf.PutString("female_hair-1"); //资源名
        buf.PutInt(0);                  //依赖资源数


        buf.PutString("res/role/female_top-1.n");
        buf.PutByte((byte)0);          //卸载类型
        buf.PutByte((byte)1);          //打包类型,多资源打包
        buf.PutString("female_top-1"); //资源名
        buf.PutInt(0);                 //依赖资源数

        buf.PutString("res/role/female_hands-1.n");
        buf.PutByte((byte)0);            //卸载类型
        buf.PutByte((byte)1);            //打包类型,多资源打包
        buf.PutString("female_hands-1"); //资源名
        buf.PutInt(0);                   //依赖资源数

        buf.PutString("res/role/female_pants-1.n");
        buf.PutByte((byte)0);            //卸载类型
        buf.PutByte((byte)1);            //打包类型,多资源打包
        buf.PutString("female_pants-1"); //资源名
        buf.PutInt(0);                   //依赖资源数

        buf.PutString("res/role/female_shoes-1.n");
        buf.PutByte((byte)0);            //卸载类型
        buf.PutByte((byte)1);            //打包类型,多资源打包
        buf.PutString("female_shoes-1"); //资源名
        buf.PutInt(0);                   //依赖资源数



        buf.PutString("res/role/female_eyes_blue.n");
        buf.PutByte((byte)0);              //卸载类型
        buf.PutByte((byte)0);              //打包类型,单独打包
        buf.PutString("female_eyes_blue"); //资源名
        buf.PutInt(0);                     //依赖资源数

        buf.PutString("res/role/female_face-colorA.n");
        buf.PutByte((byte)0);                //卸载类型
        buf.PutByte((byte)0);                //打包类型,单独打包
        buf.PutString("female_face-colorA"); //资源名
        buf.PutInt(0);                       //依赖资源数

        buf.PutString("res/role/female_hair-1_brown.n");
        buf.PutByte((byte)0);                 //卸载类型
        buf.PutByte((byte)0);                 //打包类型,单独打包
        buf.PutString("female_hair-1_brown"); //资源名
        buf.PutInt(0);                        //依赖资源数

        buf.PutString("res/role/female_top-1_blue.n");
        buf.PutByte((byte)0);               //卸载类型
        buf.PutByte((byte)0);               //打包类型,单独打包
        buf.PutString("female_top-1_blue"); //资源名
        buf.PutInt(0);                      //依赖资源数

        buf.PutString("res/role/female_hands_blue.n");
        buf.PutByte((byte)0);               //卸载类型
        buf.PutByte((byte)0);               //打包类型,单独打包
        buf.PutString("female_hands_blue"); //资源名
        buf.PutInt(0);                      //依赖资源数

        buf.PutString("res/role/female_pants-1_blue.n");
        buf.PutByte((byte)0);                 //卸载类型
        buf.PutByte((byte)0);                 //打包类型,单独打包
        buf.PutString("female_pants-1_blue"); //资源名
        buf.PutInt(0);                        //依赖资源数

        buf.PutString("res/role/female_shoes-1_blue.n");
        buf.PutByte((byte)0);                 //卸载类型
        buf.PutByte((byte)0);                 //打包类型,单独打包
        buf.PutString("female_shoes-1_blue"); //资源名
        buf.PutInt(0);                        //依赖资源数

        buf.PutString("res/role/female_anim_common.n");
        buf.PutByte((byte)0);                //卸载类型
        buf.PutByte((byte)1);                //打包类型,多资源打包
        buf.PutString("female_anim_common"); //资源名
        buf.PutInt(0);                       //依赖资源数


        b = buf.ToArray();
        FileHelper.WriteBytes2File(EditorHelper.OUTPUT_TABLE_SYSTEM_PATH + "/apkresinfo.bytes", b);
    }
Exemplo n.º 9
0
    /// <summary>
    /// 资源总表
    /// </summary>
    static void CreateResInfoTable()
    {
        //[创建资源总表]---apkresinfo.bytes------------------------------------------------------------------
        buf.Clear();
        buf.PutInt(14);        //资源条数

        //加入scnid配表资源
        //buf.PutInt(id_scnID);//资源ID
        //buf.PutByte((byte)0);//卸载类型
        //buf.PutString("scnid");//资源名
        //buf.PutInt(0);//依赖资源数

        //加入scnInfo配表资源
        buf.PutString("table/scene/scninfo0.bytes"); //资源ID
        buf.PutByte((byte)0);                        //卸载类型
        buf.PutByte((byte)0);                        //打包类型,单独打包  //TODO bytes资源是否是单独打包没什么区别,这个参数对于bytes类型是多余的,bytes和bundle加载走的不同逻辑,加或不加都不会出错
        buf.PutString("scninfo0");                   //资源名
        buf.PutInt(0);                               //依赖资源数   //TODO 需要考虑下还要不要这个依赖资源数

        //加入mapInfo配表资源
        buf.PutString("table/map/mapinfo0.bytes"); //资源ID
        buf.PutByte((byte)0);                      //卸载类型
        buf.PutByte((byte)0);                      //打包类型,单独打包
        buf.PutString("mapinfo0");                 //资源名
        buf.PutInt(0);                             //依赖资源数

        //加入terrain资源
        buf.PutString("res/map/terrain0.n");
        buf.PutByte((byte)0);      //卸载类型
        buf.PutByte((byte)0);      //打包类型,单独打包
        buf.PutString("terrain0"); //资源名
        buf.PutInt(0);             //依赖资源数

        buf.PutString("res/role/hx_basebone.n");
        buf.PutByte((byte)0);         //卸载类型
        buf.PutByte((byte)0);         //打包类型,单独打包
        buf.PutString("hx_basebone"); //资源名
        buf.PutInt(0);                //依赖资源数

//		buf.PutString("res/role/female_eyes.n");
//		buf.PutByte((byte)0);//卸载类型
//		buf.PutByte((byte)1);//打包类型,多资源打包
//		buf.PutString("female_eyes");//资源名
//		buf.PutInt(0);//依赖资源数

        buf.PutString("res/role/hx_face.n");
        buf.PutByte((byte)0);       //卸载类型
        buf.PutByte((byte)1);       //打包类型,多资源打包
        buf.PutString("hx_face-1"); //资源名
        buf.PutInt(0);              //依赖资源数

        buf.PutString("res/role/hx_head.n");
        buf.PutByte((byte)0);     //卸载类型
        buf.PutByte((byte)1);     //打包类型,多资源打包
        buf.PutString("hx_head"); //资源名
        buf.PutInt(0);            //依赖资源数


        buf.PutString("res/role/hx_top.n");
        buf.PutByte((byte)0);    //卸载类型
        buf.PutByte((byte)1);    //打包类型,多资源打包
        buf.PutString("hx_top"); //资源名
        buf.PutInt(0);           //依赖资源数

        buf.PutString("res/role/hx_hand.n");
        buf.PutByte((byte)0);     //卸载类型
        buf.PutByte((byte)1);     //打包类型,多资源打包
        buf.PutString("hx_hand"); //资源名
        buf.PutInt(0);            //依赖资源数

        buf.PutString("res/role/hx_down.n");
        buf.PutByte((byte)0);     //卸载类型
        buf.PutByte((byte)1);     //打包类型,多资源打包
        buf.PutString("hx_down"); //资源名
        buf.PutInt(0);            //依赖资源数

        buf.PutString("res/role/hx_shoes.n");
        buf.PutByte((byte)0);      //卸载类型
        buf.PutByte((byte)1);      //打包类型,多资源打包
        buf.PutString("hx_shoes"); //资源名
        buf.PutInt(0);             //依赖资源数



        buf.PutString("res/role/hanxin.n");
        buf.PutByte((byte)0);    //卸载类型
        buf.PutByte((byte)0);    //打包类型,单独打包
        buf.PutString("hanxin"); //资源名
        buf.PutInt(0);           //依赖资源数

//		buf.PutString("res/role/female_face-colorA.n");
//		buf.PutByte((byte)0);//卸载类型
//		buf.PutByte((byte)0);//打包类型,单独打包
//		buf.PutString("female_face-colorA");//资源名
//		buf.PutInt(0);//依赖资源数
//
//		buf.PutString("res/role/female_hair-1_brown.n");
//		buf.PutByte((byte)0);//卸载类型
//		buf.PutByte((byte)0);//打包类型,单独打包
//		buf.PutString("female_hair-1_brown");//资源名
//		buf.PutInt(0);//依赖资源数
//
//		buf.PutString("res/role/female_top-1_blue.n");
//		buf.PutByte((byte)0);//卸载类型
//		buf.PutByte((byte)0);//打包类型,单独打包
//		buf.PutString("female_top-1_blue");//资源名
//		buf.PutInt(0);//依赖资源数
//
//		buf.PutString("res/role/female_hands_blue.n");
//		buf.PutByte((byte)0);//卸载类型
//		buf.PutByte((byte)0);//打包类型,单独打包
//		buf.PutString("female_hands_blue");//资源名
//		buf.PutInt(0);//依赖资源数
//
//		buf.PutString("res/role/female_pants-1_blue.n");
//		buf.PutByte((byte)0);//卸载类型
//		buf.PutByte((byte)0);//打包类型,单独打包
//		buf.PutString("female_pants-1_blue");//资源名
//		buf.PutInt(0);//依赖资源数
//
//		buf.PutString("res/role/female_shoes-1_blue.n");
//		buf.PutByte((byte)0);//卸载类型
//		buf.PutByte((byte)0);//打包类型,单独打包
//		buf.PutString("female_shoes-1_blue");//资源名
//		buf.PutInt(0);//依赖资源数
//
        buf.PutString("res/role/hx_anim_common.n");
        buf.PutByte((byte)0);            //卸载类型
        buf.PutByte((byte)1);            //打包类型,多资源打包
        buf.PutString("hx_anim_common"); //资源名
        buf.PutInt(0);                   //依赖资源数

        buf.PutString("res/role/hx_anim_sk1.n");
        buf.PutByte((byte)0);         //卸载类型
        buf.PutByte((byte)1);         //打包类型,多资源打包
        buf.PutString("hx_anim_sk1"); //资源名
        buf.PutInt(0);                //依赖资源数


        b = buf.ToArray();
        FileHelper.WriteBytes2File(EditorHelper.OUTPUT_TABLE_SYSTEM_PATH + "/apkresinfo.bytes", b);
    }
Exemplo n.º 10
0
    /// <summary>
    /// 导出场景
    /// </summary>
    /// <param name="id">Identifier.</param>
    void ExportScene(int id)
    {
        Debug.Log(string.Format("step1--->开始导出场景{0}信息", id));
        byte sceneId   = Convert.ToByte(sceneIdStr);
        int  mapWidth  = Convert.ToInt32(mapWidthStr);
        int  mapHeight = Convert.ToInt32(mapHeightStr);

        string path = Path.GetDirectoryName(Application.dataPath) + "/data/bin/";

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }

        IoBuffer buffer = new IoBuffer();

        buffer.PutByte(sceneId);
        buffer.PutString(sceneNameStr);
        buffer.PutInt(mapWidth);
        buffer.PutInt(mapHeight);

        //Debug.Log("导出时buffer长度:"+buffer.ToArray().Length);
        string filename = path + "scn" + id;

        FileHelper.WriteBytes2File(filename, buffer.ToArray());

        buffer.Clear();
        buffer = null;

        Debug.Log(string.Format("导出场景{0}信息成功", filename));



        //保存场景中go到prefab
        string saveScenePrefabPath = Application.dataPath + "/Resources/Prefabs/Scenes/scn" + sceneId + "/";

        Debug.Log("step2--->开始将场景中的prefab导入到" + saveScenePrefabPath);

        //找到所有场景中Go,并保存当前场景的prefab
        foreach (GameObject obj in UnityEngine.Object.FindObjectsOfType(typeof(GameObject)))
        {
            switch (obj.name)
            {
            case "terrain":
            case "scene":
            case "dlight":
            case "obj":
            case "partical":
            case "ani":
            case "tree":

                string prefabPath = saveScenePrefabPath + obj.name + ".prefab";

                if (File.Exists(prefabPath))
                {
                    Debug.Log(string.Format(prefabPath + "存在,删除重建"));
                    File.Delete(prefabPath);
                }
                PrefabUtility.CreatePrefab(prefabPath, obj);

                break;

            default:
                Debug.LogError("ExportScene()存在场景以外其他物体:" + obj.name);
                break;
            }
        }
        Debug.Log(string.Format("保存场景{0}prefab成功", filename));


        //Debug.Log("step2--->开始将Resourse中的prefab导出成Assetbundle");
        //1 导出路径
    }
Exemplo n.º 11
0
    /// <summary>
    /// 过滤(主动)技能数据
    /// 技能数据在dataEditor中包含冗余数据,所以要进行过滤
    /// 简单描述流程
    /// 1遍历所有treeItem
    /// 2遍历每一个treeItem数据项
    /// 3找到每个treeItem中的最大skpart项,最大level
    /// 4忽略掉冗余的skpart项,无用level数据,并把有用的数据直接存到buffer中
    /// 5最后把buffer转为byte[] 返回
    /// </summary>
    /// <param name="orignalData"></param>
    /// <returns></returns>
    public static byte[] FilterExportData(Dictionary <string, Dictionary <int, KVData> > orignalData)
    {
        IoBuffer _buffer = new IoBuffer(1000000);

        int dataNum = orignalData.Count;        //技能条数

        _buffer.PutInt(dataNum);

        foreach (KeyValuePair <string, Dictionary <int, KVData> > p0 in orignalData)
        {                                                                       //遍历整个treeItem数据
            //Debug.Log("TDataExport=========================>ItemID:"+ p0.Key);
            Dictionary <int, KVData> _tempOrignalDic = p0.Value;                //获取单个treeItme的全部数据项(KVData)
            string skillpartNumStr  = _tempOrignalDic[INDEX_SKPartNum].value;   //获取skpartNum
            int    skillpartNum     = Convert.ToInt32(skillpartNumStr);
            string skillLevelNumStr = _tempOrignalDic[INDEX_SKLEVLE_NUM].value; //获取sklevelNum
            int    skillLevelNum    = Convert.ToInt32(skillLevelNumStr);

            foreach (KeyValuePair <int, KVData> p1 in _tempOrignalDic)
            {
                //遍历单个treeItem数据
                //Debug.Log("TDataExport----------->ItemIndex:" + p1.Key);

                //过滤技能段冗余数据
                if (skillpartNum < 3)
                {
                    //过滤skpart3
                    //skpart3范围
                    //Debug.Log("--->bp3  key:"+ p1.Key);
                    if (p1.Key >= INDEX_PART3_START && p1.Key <= INDEX_PART3_END)
                    {
                        //Debug.Log("--->p3");
                        continue;
                    }

                    if (skillpartNum < 2)
                    {
                        if (p1.Key >= INDEX_PART2_START && p1.Key <= INDEX_PART2_END)
                        {
                            //Debug.Log("--->p2");
                            continue;
                        }
                    }
                }

                //过滤冗余技能介绍
                if (p1.Key >= (INDEX_LEVEL_CONTENT_START + skillLevelNum) && p1.Key <= INDEX_LEVEL_CONTENT_END)
                {
                    continue;
                }


                //过滤技能等级冗余数据
                if (skillLevelNum < 10)
                {
                    if (FilterSkLevelData(p1.Key, 10)) /*Debug.Log("--->L10"); */; {
                        continue;
                    }
                    if (skillLevelNum < 9)
                    {
                        if (FilterSkLevelData(p1.Key, 9)) /*Debug.Log("--->L9"); */; {
                            continue;
                        }
                        if (skillLevelNum < 8)
                        {
                            if (FilterSkLevelData(p1.Key, 8)) /*.Log("--->L8"); */; {
                                continue;
                            }
                            if (skillLevelNum < 7)
                            {
                                if (FilterSkLevelData(p1.Key, 7)) /*.Log("--->L7"); */; {
                                    continue;
                                }
                                if (skillLevelNum < 6)
                                {
                                    if (FilterSkLevelData(p1.Key, 6)) /*.Log("--->L6"); */; {
                                        continue;
                                    }
                                    if (skillLevelNum < 5)
                                    {
                                        if (FilterSkLevelData(p1.Key, 5)) /*.Log("--->L5"); */ continue {
                                            ;
                                        }
                                        if (skillLevelNum < 4)
                                        {
                                            if (FilterSkLevelData(p1.Key, 4)) /*.Log("--->L4"); */ continue {
                                                ;
                                            }
                                            if (skillLevelNum < 3)
                                            {
                                                if (FilterSkLevelData(p1.Key, 3)) /*.Log("--->L3"); */ continue {
                                                    ;
                                                }
                                                if (skillLevelNum < 2)
                                                {
                                                    if (FilterSkLevelData(p1.Key, 2)) /*.Log("--->L2"); */ continue {
                                                        ;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }