Ejemplo n.º 1
0
        public void SetShopGoldItemInfo(ShopGoldItemInfo shopGoldItemInfo)
        {
            _shopGoldItemInfo    = shopGoldItemInfo;
            nameText.text        = Localization.Get(_shopGoldItemInfo.ShopLimitItemData.name);
            descriptionText.text = Localization.Get(_shopGoldItemInfo.ShopLimitItemData.description);
            itemIconImage.SetSprite(ResMgr.instance.Load <Sprite>(ResPath.GetShopItemIconPath(_shopGoldItemInfo.ShopLimitItemData.pic)));
            itemIconImage.SetNativeSize();

            freeTimesRoot.SetActive(false);
            limitTimesRoot.SetActive(false);
            freeCountDownSlider.gameObject.SetActive(false);

            costResourceIcon.SetSprite(ResMgr.instance.Load <Sprite>(UIUtil.GetBaseResIconPath(_shopGoldItemInfo.ShopLimitItemData.costGameResData.type)));
            costResourceIcon.SetNativeSize();
            costResourceCountText.text = _shopGoldItemInfo.ShopLimitItemData.costGameResData.count.ToString();

            if (_shopGoldItemInfo.RemainPurchaseTimes > 0)
            {
                buyButton.gameObject.SetActive(true);
                soldOutButton.gameObject.SetActive(false);
            }
            else
            {
                buyButton.gameObject.SetActive(false);
                soldOutButton.gameObject.SetActive(true);
            }
        }
Ejemplo n.º 2
0
        void menu_modify(object sender, EventArgs e)
        {
            if (this.listView_map.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选择要修改的事项");
                return;
            }

            DbNameMapItemDlg dlg = new DbNameMapItemDlg();

            dlg.Font        = GuiUtil.GetDefaultFont();
            dlg.SearchPanel = this.SearchPanel;
            dlg.Origin      = ResPath.GetRegularRecordPath(this.listView_map.SelectedItems[0].SubItems[0].Text);
            dlg.Target      = ResPath.GetRegularRecordPath(this.listView_map.SelectedItems[0].SubItems[1].Text);
            dlg.WriteMode   = this.listView_map.SelectedItems[0].SubItems[2].Text;

            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            this.listView_map.SelectedItems[0].SubItems[0].Text = ResPath.GetReverseRecordPath(dlg.Origin);
            this.listView_map.SelectedItems[0].SubItems[1].Text = ResPath.GetReverseRecordPath(dlg.Target);
            this.listView_map.SelectedItems[0].SubItems[2].Text = ResPath.GetReverseRecordPath(dlg.WriteMode);
        }
Ejemplo n.º 3
0
        public void Show()
        {
            if (_chapterInfo == null)
            {
                return;
            }

            string  chapterBGTexturePath = ResPath.GetChapterBGPath(_chapterInfo.chapterData.chapterBG);
            Texture chapterBGTexture     = ResMgr.instance.Load <Texture>(chapterBGTexturePath);

            chapterBGRawImage.texture = chapterBGTexture;
            chapterBGRawImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, CHAPTER_BG_WIDTH);
            chapterBGRawImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, CHAPTER_BG_HEIGHT);

            Bounds bounds = RectTransformUtility.CalculateRelativeRectTransformBounds(transform);

            rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, bounds.size.x);
            rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, bounds.size.y);

            string  chapterBGLineTexturePath = ResPath.GetChapterBGPath(_chapterInfo.chapterData.chapterLineBG);
            Texture chapterBGLineTexture     = ResMgr.instance.Load <Texture>(chapterBGLineTexturePath);

            chapterBGLineRawImage.texture = chapterBGLineTexture;
            chapterBGRawImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, CHAPTER_BG_WIDTH);
            chapterBGRawImage.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, CHAPTER_BG_HEIGHT);
        }
Ejemplo n.º 4
0
    public void CastSkill(int skillIndex = -1)
    {
        var roleGameOE = RoleMgr.GetInstance().GetMainRole();
        var roleInfo   = roleGameOE.GetComponent <RoleInfo>();
        var skillID    = SkillManager.GetInstance().GetSkillIDByIndex(skillIndex);

        string assetPath      = ResPath.GetRoleSkillResPath(skillID);
        bool   isNormalAttack = skillIndex == -1;//普通攻击

        if (!isNormalAttack)
        {
            SkillManager.GetInstance().ResetCombo();//使用非普攻技能时就重置连击索引
        }
        var uid = SceneMgr.Instance.EntityManager.GetComponentData <UID>(roleGameOE.Entity);
        Action <TimelineInfo.Event> afterAdd = null;

        if (isNormalAttack)
        {
            //普攻的话增加连击索引
            afterAdd = (TimelineInfo.Event e) =>
            {
                if (e == TimelineInfo.Event.AfterAdd)
                {
                    SkillManager.GetInstance().IncreaseCombo();
                }
            };
        }
        var timelineInfo = new TimelineInfo {
            ResPath = assetPath, Owner = roleGameOE.Entity, StateChange = afterAdd
        };

        TimelineManager.GetInstance().AddTimeline(uid.Value, timelineInfo, SceneMgr.Instance.EntityManager);
    }
Ejemplo n.º 5
0
        // 关联本地目录
        private void menuItem_linkLocalDir_Click(object sender, System.EventArgs e)
        {
            string strDefault = "";

            if (treeView_res.SelectedNode != null)
            {
                ResPath respath = new ResPath(treeView_res.SelectedNode);


                if (treeView_res.SelectedNode.ImageIndex == ResTree.RESTYPE_FOLDER)
                {
                    strDefault = respath.FullPath;
                }
                else
                {
                    strDefault = respath.Url;
                }
            }


            LinkInfoDlg dlg = new LinkInfoDlg();

            MainForm.SetControlFont(dlg, this.DefaultFont);

            dlg.LinkInfos           = this.LinkInfos;
            dlg.CreateNewServerPath = strDefault;
            dlg.ShowDialog(this);
        }
Ejemplo n.º 6
0
    //--------------------------------------------------------------------------------------------
    // 下载需要的资源列表 [ 每次启动都要同步 ]
    void NtfDownLoadResList(bool bLcl)
    {
        if (Application.isEditor && !ForcePackage)
        {
            return;   // 编辑器直接读本地资源
        }
        SetLoading();
        mMsg = @"正在同步资源列表, ...";
        string szfNm = ResPath.GetResListTxt();
        string szUrl = ResPath.GetUrl(szfNm);
        string szLcl = ResPath.GetLocal(szfNm);

        if (bLcl)
        {
            mMsg = @"从本地读取资源列表, ...";
            Debug.LogWarning("Try local0, File = " + szLcl);
            mResDic = ResUtil.ReadResTable(szLcl);
            //if (mResDic != null)
            {// 构建资源与数据包的对应关系并下载
                BuildPackListAndDownLoad();
            }
            return;
        }
        mMsg = @"从网络读取资源列表, ...";
        mEntry.StartCoroutine(DownLoadResList(szUrl, szLcl));
    }
Ejemplo n.º 7
0
    //--------------------------------------------------------------------------------------------
    // 下载资源列表文件
    IEnumerator DownLoadResList(string szUrl, string szLcl)
    {
        mMsg = "Download file " + szUrl;
        WWW wDwn = new WWW(szUrl);

        while (!wDwn.isDone)
        {
            yield return(wDwn);
        }
        if (wDwn.isDone && (null == wDwn.error))
        {
            mResDic = ResUtil.ReadResTable(wDwn.bytes);
            if ((mResDic != null) && (mResDic.Count > 0))
            {
                ResPath.SaveToLocal(szLcl, wDwn.bytes);
            }
        }
        else if (null != wDwn.error)
        {
            mMsg = "DownResList ERROR, Msg = " + wDwn.error;
            Debug.LogWarning("DownResList ERROR, Url = " + szUrl + ", Msg = " + wDwn.error);
        }
        if ((mResDic == null) || (mResDic.Count <= 0))
        {
            Debug.LogWarning("Try local1, File = " + szLcl);
            mResDic = ResUtil.ReadResTable(szLcl);
        }
        BuildPackListAndDownLoad();   // 构建资源与数据包的对应关系并下载
    }
Ejemplo n.º 8
0
        // 检索册信息过程中,处理结果集中每条记录的回调函数
        void SearchItems_BrowseRecord(object sender, BrowseRecordEventArgs e)
        {
            ResPath respath = new ResPath(e.FullPath);

            XmlDocument tempdom = null;

            byte[] baTimeStamp = null;
            string strError    = "";

            int nRet = this.SearchPanel.GetRecord(
                respath.Url,
                respath.Path,
                out tempdom,
                out baTimeStamp,
                out strError);

            if (nRet == -1)
            {
                goto ERROR1;
            }

            BookItem item = new BookItem(respath.Path, tempdom);

            item.Timestamp = baTimeStamp;
            this.Items.Add(item);

            item.AddToListView(this.listView_items);

            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Ejemplo n.º 9
0
    void LoadAllSavedFileMD5(string md5FileName)
    {
        m_md5List.Clear();
        byte[] buffer = ResPath.GetFileData(md5FileName);
        if (buffer == null)
        {
            return;
        }
        MemoryStream mryStm = new MemoryStream(buffer);
        StreamReader stm    = new StreamReader(mryStm);
        string       line   = stm.ReadLine();

        while (line != null)
        {
            if (line.Length == 0)
            {
                continue;
            }
            string[] nameAndVersion = line.Split('|');

            if (nameAndVersion.Length > 1)
            {
                m_md5List[nameAndVersion[0]] = nameAndVersion[1];
            }
            line = stm.ReadLine();
        }
    }
Ejemplo n.º 10
0
        private void treeView_resRightTree_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            if (treeView_resRightTree.SelectedNode == null)
            {
                return;
            }

            // NodeInfo nodeinfo = (NodeInfo)treeView_resRightTree.SelectedNode.Tag;

            // bool bExpandable = false;

            // if (nodeinfo != null)
            //  bExpandable = nodeinfo.Expandable;

            ResPath respath = new ResPath(treeView_resRightTree.SelectedNode);

            this.textBox_objectRights_rights.Text = ResRightTree.GetNodeRights(treeView_resRightTree.SelectedNode);
            this.label_objectRights_rights.Text   = "对象 '" + respath.Path + "' 的权限(&R)";

            if (ResRightTree.GetNodeExpandable(treeView_resRightTree.SelectedNode) == false)
            {
                listView_resRightList.Items.Clear();
            }
            else
            {
                listView_resRightList.Path = respath.Path;
                listView_resRightList.Fill();
            }
        }
Ejemplo n.º 11
0
        void OnLoadDetail()
        {
            if (this.OpenDetail == null)
            {
                return;
            }

            if (this.listView_records.SelectedItems.Count == 0)
            {
                return;
            }

            string[] paths = new string[this.listView_records.SelectedItems.Count];
            for (int i = 0; i < this.listView_records.SelectedItems.Count; i++)
            {
                string strPath = this.listView_records.SelectedItems[i].Text;

                paths[i] = ResPath.GetRegularRecordPath(strPath);
            }

            OpenDetailEventArgs args = new OpenDetailEventArgs();

            args.Paths   = paths;
            args.OpenNew = true;

            this.listView_records.Enabled = false;
            this.OpenDetail(this, args);
            this.listView_records.Enabled = true;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 装入第一条记录到详细窗
        /// </summary>
        /// <param name="bCloseWindow"></param>
        public void LoadFirstDetail(bool bCloseWindow)
        {
            if (this.listView_records.Items.Count == 0)
            {
                return;
            }

            string[] paths = new string[1];
            paths[0] = ResPath.GetRegularRecordPath(this.listView_records.Items[0].Text);

            OpenDetailEventArgs args = new OpenDetailEventArgs();

            args.Paths   = paths;
            args.OpenNew = false;

            this.listView_records.Enabled = false;
            this.OpenDetail(this, args);
            this.listView_records.Enabled = true;

            if (bCloseWindow == true)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Ejemplo n.º 13
0
        public void SetShopGoodItemInfo(ShopGoodsItemInfo shopGoodsItemInfo)
        {
            _shopGoodsItemInfo = shopGoodsItemInfo;

            GameResData goodsGameResData = _shopGoodsItemInfo.ShopGoodsData.goodsGameResData;

            nameText.text        = Localization.Get(_shopGoodsItemInfo.ShopGoodsData.name);
            descriptionText.text = Localization.Get(_shopGoodsItemInfo.ShopGoodsData.description);

            string itemIconSpritePath = string.Empty;

            if (!string.IsNullOrEmpty(_shopGoodsItemInfo.ShopGoodsData.pic))
            {
                itemIconSpritePath = ResPath.GetShopItemIconPath(_shopGoodsItemInfo.ShopGoodsData.pic);
            }
            else
            {
                if (goodsGameResData.type == Logic.Enums.BaseResType.Item)
                {
                    ItemData itemData = ItemData.GetItemDataByID(goodsGameResData.id);
                    itemIconSpritePath = ResPath.GetItemIconPath(itemData.icon);
                }
                else if (goodsGameResData.type == Logic.Enums.BaseResType.Hero)
                {
                    HeroData heroData = HeroData.GetHeroDataByID(goodsGameResData.id);
                    itemIconSpritePath = ResPath.GetCharacterHeadIconPath(heroData.headIcons[heroData.starMin - 1]);
                }
            }
            itemIconImage.SetSprite(ResMgr.instance.Load <Sprite>(itemIconSpritePath));
            itemIconImage.SetNativeSize();

            costResourceIcon.SetSprite(ResMgr.instance.Load <Sprite>(UIUtil.GetBaseResIconPath(_shopGoodsItemInfo.ShopGoodsData.costGameResData.type)));
            costResourceIcon.SetNativeSize();
            costResourceCountText.text = _shopGoodsItemInfo.ShopGoodsData.costGameResData.count.ToString();

            freeTimesRoot.SetActive(false);
            freeCountDownSlider.gameObject.SetActive(false);

            if (_shopGoodsItemInfo.ShopGoodsData.itemNum > 0)
            {
                if (_shopGoodsItemInfo.RemainPurchaseTimes > 0)
                {
                    buyButton.gameObject.SetActive(true);
                    soldOutButton.gameObject.SetActive(false);
                }
                else
                {
                    buyButton.gameObject.SetActive(false);
                    soldOutButton.gameObject.SetActive(true);
                }
                limitTimesText.text = string.Format(Localization.Get("common.value/max"), _shopGoodsItemInfo.RemainPurchaseTimes, _shopGoodsItemInfo.ShopGoodsData.itemNum);
                limitTimesRoot.SetActive(true);
            }
            else
            {
                limitTimesRoot.SetActive(false);
                buyButton.gameObject.SetActive(true);
                soldOutButton.gameObject.SetActive(false);
            }
        }
Ejemplo n.º 14
0
        public void SetShopEquipmentRandomCardInfo(ShopEquipmentRandomCardInfo shopEquipmentRandomCardInfo)
        {
            _shopEquipmentRandomCardInfo = shopEquipmentRandomCardInfo;
            nameText.text        = Localization.Get(_shopEquipmentRandomCardInfo.ShopCardRandomData.name);
            descriptionText.text = Localization.Get(_shopEquipmentRandomCardInfo.ShopCardRandomData.description);
            itemIconImage.SetSprite(ResMgr.instance.Load <Sprite>(ResPath.GetShopItemIconPath(_shopEquipmentRandomCardInfo.ShopCardRandomData.pic)));
            itemIconImage.SetNativeSize();
            costResourceIcon.SetSprite(ResMgr.instance.Load <Sprite>(UIUtil.GetBaseResIconPath(_shopEquipmentRandomCardInfo.ShopCardRandomData.costGameResData.type)));
            costResourceIcon.SetNativeSize();
            costResourceCountText.text = _shopEquipmentRandomCardInfo.ShopCardRandomData.costGameResData.count.ToString();

//			freeTimesRoot.gameObject.SetActive(_shopEquipmentRandomCardInfo.ShopCardRandomData.freeTime > 0);
//			freeTimesText.text = string.Format(Localization.Get("common.value/max"), _shopEquipmentRandomCardInfo.RemainFreeTimes, _shopEquipmentRandomCardInfo.ShopCardRandomData.max);

            //免费抽卡取消每日次数限制,遂不在显示次数
            freeTimesRoot.gameObject.SetActive(false);

            if (_shopEquipmentRandomCardInfo.RemainFreeTimes > 0)
            {
                if (_shopEquipmentRandomCardInfo.NextFreeBuyCountDownTime > 0)
                {
                    costResourceCountText.text = _shopEquipmentRandomCardInfo.ShopCardRandomData.costGameResData.count.ToString();
                    freeCountDownSlider.gameObject.SetActive(true);
                    _isCountingDown = true;
                }
                else
                {
                    costResourceCountText.text = Localization.Get("ui.shop_view.free");
                    freeCountDownSlider.gameObject.SetActive(false);
                }
            }
            limitTimesRoot.SetActive(false);
            buyButton.gameObject.SetActive(true);
            soldOutButton.gameObject.SetActive(false);
        }
Ejemplo n.º 15
0
        // 将远程书目库名替换为本地书目库名
        // return:
        //      -1  出错
        //      0   没有找到对应的本地书目库
        //      1   找到,并已经替换
        public int ReplaceBiblioRecPath(
            string strServer,
            ref string strRecPath,
            out string strError)
        {
            strError = "";

            string strDbName = ResPath.GetDbName(strRecPath);
            string strID     = ResPath.GetRecordId(strRecPath);

            foreach (ItemDbCfg cfg in this.ItemDbs)
            {
                if (cfg.ReplicationServer != strServer)
                {
                    continue;
                }
                if (strDbName == cfg.ReplicationDbName)
                {
                    strRecPath = cfg.BiblioDbName + "/" + strID;
                    return(1);
                }
            }

            strRecPath = "";
            return(0);
        }
Ejemplo n.º 16
0
        // 装入详细记录
        void browseWindow_OpenDetail(object sender, OpenDetailEventArgs e)
        {
            if (e.Paths.Length == 0)
            {
                return;
            }

            ResPath respath = new ResPath(e.Paths[0]);

            string strError = "";
            int    nRet     = LoadBiblioRecord(
                respath.Path,
                out strError);

            if (nRet == -1)
            {
                goto ERROR1;
            }

            return;

ERROR1:
            MessageBox.Show(this, strError);
            return;
        }
Ejemplo n.º 17
0
    //--------------------------------------------------------------------------------------------
    // 保存资源列表, 存在则合并
    public static void WriteResList(Dictionary <string, ResPackItm> tbl, BuildTarget tgt)
    {
        Dictionary <string, ResPackItm> ntbl = tbl;
        string sPth = BuildGameCMD.GetBuildFolder(tgt);

        sPth = sPth.Replace("\\", "/");
        if (!sPth.EndsWith("/"))
        {
            sPth += "/";
        }
        string sf = sPth + ResPath.GetResListTxt();

        if (File.Exists(sf))
        {
            try
            {
                FileStream stm = new FileStream(sf, FileMode.Open, FileAccess.Read);
                if (stm.Length > 0)
                {
                    byte[] vAry = new byte[stm.Length];
                    stm.Read(vAry, 0, vAry.Length);
                    Dictionary <string, ResPackItm> otbl = ResUtil.ReadResTable(vAry);
                    ntbl = ResUtil.ReplaceAndMergeResTable(tbl, otbl);
                }
                stm.Close();
            }
            catch (Exception exp)
            {
                Debug.LogWarning("CAN NOT Open file = " + sf + ", Msg = " + exp.Message);
            }
        }
        ResUtil.WriteResTable(sf, ntbl);
    }
Ejemplo n.º 18
0
    // 测试本地资源是否存在
    static public bool LocalResExist()
    {
        string sPth = GetLocal();

        try
        {
            if (!Directory.Exists(sPth))
            {
                return(false);
            }
        }
        catch (Exception exp)
        {
            Debug.Log("LocalResExist() DirEr = " + sPth + ", Msg = " + exp.Message);
            return(false);
        }

        string sf = GetLocal(ResPath.GetResListTxt());

        try
        {
            if (File.Exists(sf))
            {
                return(true);
            }
        }
        catch (Exception exp)
        {
            Debug.Log("LocalResExist() File.DirEr = " + sf + ", Msg = " + exp.Message);
        }
        return(false);
    }
Ejemplo n.º 19
0
        public void Init()
        {
            skillIcon.SetSprite(ResMgr.instance.Load <Sprite>(ResPath.GetSkillIconPath(_skillInfo.skillData.skillIcon)));
            //SkillDesButton desBtn = SkillDesButton.Get(gameObject);

            //desBtn.SetSkillInfo(_skillInfo, 0,0,0.5f);
        }
Ejemplo n.º 20
0
        //解析服务器传过来的头像编号 由heroid + star组成
        public static string ParseHeadIcon(int headNo)
        {
            //headicon

            int headHeroId = headNo / 10;
            int headStar   = (headNo - headHeroId * 10);

            //int isPet = headNo - headHeroId*100 - headStar*10;

            Logic.Hero.Model.HeroData heroData = Logic.Hero.Model.HeroData.GetHeroDataByID(headHeroId);

            if (heroData != null)
            {
//				if(heroData.hero_type == 2 )//主角
//				{
//					Logic.Pet.Model.PetData petdata = Logic.Pet.Model.PetData.GetPetDataByID(Logic.Player.Model.PlayerData.GetPlayerData((uint)headHeroId).pet_id);
//					return Common.ResMgr.ResPath.GetCharacterHeadIconPath(petdata.head_icon);
//				}else if(headStar <= heroData.headIcons.Length)
//				{
                return(ResPath.GetCharacterHeadIconPath(heroData.headIcons[headStar - 1]));
//				}
            }
            Debugger.LogError(string.Format("头像找不到 headHeroId :{0},star:{0}", headHeroId, headStar));
            return(Logic.Game.Model.GameProxy.instance.PlayerInfo.HeadIcon);
        }
Ejemplo n.º 21
0
        internal void SetData(BuffInst buffInst)
        {
            BuffTemplate templet = BuffTemplateData.GetData(buffInst.tplId);

            if (templet == null)
            {
                return;
            }
            img.url = ResPath.GetUiImagePath(PackageName.BATTLE, templet.szImg);
            switch (templet.nType)
            {
            case BuffType.ADD_ARMOR_ROUND_END:
            case BuffType.MULTI_ARMOR:
                txtValue.text    = buffInst.effectVal.ToString();
                txtValue.visible = true;
                break;

            case BuffType.MAGIC_SWORD:      //幻剑
                txtValue.text    = buffInst.effectVal.ToString();
                txtValue.visible = true;
                break;

            default:
                txtValue.text    = buffInst.leftBout.ToString();
                txtValue.visible = buffInst.leftBout > 0;
                break;
            }
        }
Ejemplo n.º 22
0
        public void SetActivityInfo(ActivityInfo activityInfo)
        {
            _activityInfo             = activityInfo;
            dailyDungeonNameText.text = Localization.Get(_activityInfo.ActivityData.name);
            dailyDungeonCardImage.SetSprite(ResMgr.instance.Load <Sprite>(ResPath.GetActivityIconPath(activityInfo.ActivityData.pic)));
            lockMaskGameObject.SetActive(!_activityInfo.isOpen);

            string openDaysString = string.Empty;

            if (_activityInfo.ActivityData.openDayList.Count < 7)
            {
                openDaysString = UIUtil.GetWeekdayListString(_activityInfo.ActivityData.openDayList);
                openDaysString = string.Format(Localization.Get("ui.daily_dungeon_view.open_date"), openDaysString);
            }
            else
            {
                openDaysString = Localization.Get("ui.daily_dungeon_view.open_every_day");
            }
            openDateText.text = openDaysString;

            if (!_activityInfo.isOpen)
            {
                SetToGray();
            }
        }
Ejemplo n.º 23
0
    protected override void OnUpdate()
    {
        // Debug.Log("on OnUpdate role looks system");
        var requestArray = SpawnGroup.ToComponentDataArray <RoleLooksSpawnRequest>(Allocator.TempJob);

        if (requestArray.Length == 0)
        {
            requestArray.Dispose();
            return;
        }

        var requestEntityArray = SpawnGroup.ToEntityArray(Allocator.TempJob);

        // Copy requests as spawning will invalidate Group
        var spawnRequests = new RoleLooksSpawnRequest[requestArray.Length];

        for (var i = 0; i < requestArray.Length; i++)
        {
            spawnRequests[i] = requestArray[i];
            PostUpdateCommands.DestroyEntity(requestEntityArray[i]);
        }

        for (var i = 0; i < spawnRequests.Length; i++)
        {
            var request = spawnRequests[i];
            // var playerState = EntityManager.GetComponentObject<RoleState>(request.ownerEntity);
            var looksInfo = EntityManager.GetComponentData <LooksInfo>(request.ownerEntity);
            int career    = request.career;
            int body      = request.body;
            int hair      = request.hair;
            // Debug.Log("body : "+body+" hair:"+hair);
            string bodyPath = ResPath.GetRoleBodyResPath(career, body);
            string hairPath = ResPath.GetRoleHairResPath(career, hair);
            // Debug.Log("SpawnRoleLooks bodyPath : "+bodyPath);
            XLuaFramework.ResourceManager.GetInstance().LoadAsset <GameObject>(bodyPath, delegate(UnityEngine.Object[] objs) {
                if (objs != null && objs.Length > 0)
                {
                    GameObject bodyObj        = objs[0] as GameObject;
                    GameObjectEntity bodyOE   = m_world.Spawn <GameObjectEntity>(bodyObj);
                    var parentTrans           = EntityManager.GetComponentObject <Transform>(request.ownerEntity);
                    parentTrans.localPosition = request.position;
                    bodyOE.transform.SetParent(parentTrans);
                    bodyOE.transform.localPosition = Vector3.zero;
                    bodyOE.transform.localRotation = Quaternion.identity;
                    ECSHelper.UpdateNameboardHeight(request.ownerEntity, bodyOE.transform);
                    LoadHair(hairPath, bodyOE.transform.Find("head"));
                    // Debug.Log("load ok role model");
                    looksInfo.CurState    = LooksInfo.State.Loaded;
                    looksInfo.LooksEntity = bodyOE.Entity;
                    EntityManager.SetComponentData <LooksInfo>(request.ownerEntity, looksInfo);
                }
                else
                {
                    Debug.LogError("cannot fine file " + bodyPath);
                }
            });
        }
        requestEntityArray.Dispose();
        requestArray.Dispose();
    }
Ejemplo n.º 24
0
    //--------------------------------------------------------------------------------------------
    static public bool GetVersion(ref string sGmV, ref string sResV)
    {
        string szfNm = ResPath.GetVersionTxt();
        string szLcl = ResPath.GetLocal(szfNm);

        byte[] dt = ResPath.GetFileData(szLcl);
        return(GetVersion(dt, ref sGmV, ref sResV));
    }
Ejemplo n.º 25
0
 /// <summary>
 /// 使用敌人数据初始化
 /// </summary>
 /// <param name="enemyInstance"></param>
 public void Init(EnemyInstance enemyInstance)
 {
     instId = enemyInstance.instId;
     rootContainer.touchChildren = false;
     pgsHp.max     = pgsHp.value = enemyInstance.maxHp;
     imgAvatar.url = ResPath.GetUiImagePath(PackageName.BATTLE, "guaiwu");   //todo 从敌人模板表读取外观
     SetBuffInstList(enemyInstance.lstBuffInst);
 }
Ejemplo n.º 26
0
 public static Dictionary <int, BreakthroughData> GetBreakthroughDatas()
 {
     if (_breakthroughDataDictionary == null)
     {
         _breakthroughDataDictionary = CSVUtil.Parse <int, BreakthroughData>(ResPath.GetConfigFilePath("breakthrough"), "id");
     }
     return(_breakthroughDataDictionary);
 }
Ejemplo n.º 27
0
    public void SaveProject(string folder)
    {
        //if (m_isDirty)
        {
//            m_isDirty = false;
            m_version.SavePackageVersion(folder + "/" + ResPath.GetPackageVersionTxt());
            SaveAllFileMD5(folder + "/PackedFileMD5.txt");
        }
    }
Ejemplo n.º 28
0
 internal void SetData(RelicBase relicBase)
 {
     _relicBase = relicBase;
     _template  = RelicTemplateData.GetData(relicBase.tplId);
     if (_template == null)
     {
         return;
     }
     imgRelic.url = ResPath.GetUiImagePath(PackageName.RELIC, _template.szImg);
 }
Ejemplo n.º 29
0
        private void RefreshItemIconImage()
        {
            Sprite sprite = ResMgr.instance.Load <Sprite>(ResPath.GetItemIconPath(_itemInfo.itemData.icon));

            if (sprite != null)
            {
                itemIconImage.SetSprite(sprite);
                //itemIconImage.SetNativeSize();
            }
        }
Ejemplo n.º 30
0
    //协程-下载更新包
    IEnumerator Coroutine_DownloadUpdatePackage()
    {
        while (DownIndex < UpdateList.Count)
        {
            XML_PackMD5.Info info = UpdateList[DownIndex];
            ++DownIndex;
            bool isSucc = false;
            if (long.Parse(info.FileSize) != 0)
            {//下载
                string filename = info.PackName;
                string url      = ResPath.GetServerPackURL(filename);
                WWW    down     = new WWW(url);
                while (!down.isDone)
                {
                    yield return(down);
                }
                if (down.isDone && down.error == null)
                {
                    if (ResUtil.SaveFile(down.bytes, ResPath.LocalPackagePath, filename))
                    {//保存文件成功
                        isSucc = true;
                    }
                    else
                    {//保存文件失败
                        Debug.LogWarning("save file failed! file = " + ResPath.LocalPackagePath + filename);
                    }
                }
                else
                {
                    Debug.LogWarning("download failed, url = " + url + ",isDone:" + down.isDone + ",error:" + down.error);
                }
            }
            else
            {
                isSucc = true;
            }
            if (isSucc)
            {//更新成功
                SuccList.Add(info);
                //更新本地
                PackMD5Local.Update(info);
                FilePackLocal.Update(info.PackName, FilePackRemote);
                PackDependLocal.Update(info.PackName, PackDependRemote);

                DownSize += long.Parse(info.FileSize);
            }
            else
            {
                FailList.Add(info);

                //DownSize += long.Parse(info.FileSize);
            }
        }
    }