Exemple #1
0
        /// <summary>
        /// 设置奖励信息
        /// </summary>
        /// <param name="index"></param>
        /// <param name="gid"></param>
        /// <param name="bind"></param>
        /// <param name="num"></param>
        void SetReward(int index, uint gid, uint num)
        {
            UIItemNewSlot item_slot = null;

            if (index >= mItemSlots.Count)
            {
                item_slot = UIItemNewSlot.Bind(mTemplateObj).ReplaceItemPrefab();
                mItemSlots.Add(item_slot);
            }
            else
            {
                item_slot = mItemSlots[index];
            }

            var goods = GoodsHelper.CreateGoodsByTypeId(gid);

            goods.num = (ulong)num;

            var type_parse = UIItemNewSlot.CreateUIItemTypeParse(2);

            item_slot.setItemInfo(goods, type_parse);
        }
Exemple #2
0
            /// <summary>
            /// 通过内存池来创建物品图标
            /// </summary>
            /// <param name="template"></param>
            /// <param name="wnd_name"></param>
            /// <param name="goodsID"></param>
            /// <param name="num"></param>
            /// <param name="isShowTips"></param>
            /// <param name="isScale"></param>
            /// <param name="isBind"></param>
            /// <returns></returns>
            public GameObject CreateGoodsItemCache(GameObject template, string wnd_name, Transform parent, uint goodsID, ulong num, bool isShowTips = true, bool isScale = false, uint isBind = uint.MaxValue)
            {
                if (template == null)
                {
                    return(null);
                }

                var wnd = UIManager.instance.GetWindow(wnd_name);

                if (wnd == null)
                {
                    return(null);
                }

                var gameObject = wnd.GetItemGameObj(parent);

                UIItemRef itemRef = template.GetComponent <UIItemRef>();

                UIItemNewSlot newSlot = template.GetComponent <UIItemNewSlot>();

                gameObject.transform.SetParent(template.transform.parent, false);
                gameObject.SetActive(true);

                UIItemNewSlot itemSlot;

                if (itemRef)
                {
                    itemSlot = UIItemNewSlot.Bind(gameObject, itemRef.TargetPanel, itemRef.ClipPanel);
                }
                else if (newSlot)
                {
                    itemSlot = UIItemNewSlot.Bind(gameObject, newSlot.TargetPanel, newSlot.ClipPanel);
                }
                else
                {
                    itemSlot = UIItemNewSlot.Bind(gameObject);
                }

                Goods itemInfo = GoodsHelper.CreateGoodsByTypeId(goodsID);

                if (isShowTips == false && isScale == false)
                {
                    var collider = gameObject.GetComponent <Collider>();

                    if (collider != null)
                    {
                        collider.enabled = false;
                    }
                }

                if (itemInfo == null)
                {
                    GameDebug.LogError("CreateGoodsItem error, can not find goods " + goodsID);
                    return(gameObject);
                }
                itemInfo.num = num;
                if (isBind != uint.MaxValue)
                {
                    itemInfo.bind = isBind;
                }

                UIItemNewSlot.TypeParse typeParse = UIItemNewSlot.CreateUIItemTypeParse();

                if (isShowTips == true)
                {
                    typeParse._mType = 2;
                }
                else
                {
                    typeParse._mType = 0;
                }

                itemSlot.setItemInfo(itemInfo, typeParse, isScale);
                return(gameObject);
            }
Exemple #3
0
        public static void ResponseClickEmojiTextHref(string origText)
        {
            if (origText.Contains("goodsOid"))
            {
                string idStr  = origText.Replace("goodsOid=", "");
                var    matchs = Regex.Matches(idStr, @"\{(\d+),(\d+)\}");
                foreach (Match _match in matchs)
                {
                    if (_match.Success)
                    {
                        uint             sendId   = (DBTextResource.ParseUI(_match.Groups[1].Value));
                        ulong            goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0);
                        Net.C2STalkGoods pack     = new Net.C2STalkGoods();
                        pack.uuid = sendId;
                        pack.oid  = goodsOid;
                        //GameDebug.LogError("===============  OnClickHref test");
                        Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack);
                    }
                }

                //兼容3个参数和2个参数
                matchs = Regex.Matches(idStr, @"\{(\d+),(\d+),(\d+)\}");
                foreach (Match _match in matchs)
                {
                    if (_match.Success)
                    {
                        uint             sendId   = (DBTextResource.ParseUI(_match.Groups[1].Value));
                        ulong            goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0);
                        ulong            goodsGid = DBTextResource.ParseUL_s(_match.Groups[3].Value, 0);
                        Net.C2STalkGoods pack     = new Net.C2STalkGoods();
                        pack.uuid = sendId;
                        pack.oid  = goodsOid;
                        pack.gid  = (uint)goodsGid;
                        Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack);
                    }
                }
            }
            else if (origText.Contains("teamId"))
            {
                var idStr  = origText.Replace("teamId=", "");
                var teamId = uint.Parse(idStr);
                TeamManager.Instance.Apply(teamId);
            }
            else if (origText.Contains("playerId"))
            {//查看玩家
                var           idStr      = origText.Replace("playerId=", "");
                List <string> param_list = DBTextResource.ParseArrayString(idStr, ";");
                if (param_list.Count >= 5)
                {
                    // 不能查看玩家自己的信息
                    if (param_list[0].Equals(LocalPlayerManager.Instance.LocalActorAttribute.UnitId.obj_idx.ToString()) == false)
                    {
                        Dictionary <string, string> playerInfo = new Dictionary <string, string>();
                        playerInfo.Clear();
                        playerInfo.Add("uuid", param_list[0]);
                        xc.ui.ugui.UIManager.Instance.ShowWindow("UIWatchPlayerWindow", playerInfo);
                    }
                }
                else
                {
                    GameDebug.LogError("playerId param is error! idStr = " + idStr);
                }
            }
            else if (origText.Contains("jumpSysId="))
            {//跳转系统ID
                var           idStr      = origText.Replace("jumpSysId=", "");
                List <string> param_list = DBTextResource.ParseArrayString(idStr, ";");
                if (param_list.Count >= 1)
                {
                    uint sys_id = 0;
                    if (uint.TryParse(param_list[0], out sys_id))
                    {
                        if (LuaScriptMgr.Instance != null)
                        {
                            XLua.LuaFunction func = LuaScriptMgr.Instance.GetLuaFunction(LuaScriptMgr.Instance.Lua.Global, "GotoSysRouter_chatItem");
                            if (func != null)
                            {
                                func.Action(param_list);
                            }
                        }
                    }
                }
                else
                {
                    GameDebug.LogError("jumpSysId param is error! idStr = " + idStr);
                }
            }
            else if (origText.Contains("clientGoodsTips"))
            {//客户端拼凑的物品TIPS
                string idStr = origText;
                //var idStr = origText.Replace("clientGoodsTips=", "");
                var matchs = Regex.Matches(origText, @"clientGoodsTips=\{(.+)\}");
                foreach (Match _match in matchs)
                {
                    if (_match.Success)
                    {
                        idStr = _match.Groups[1].Value;
                    }
                }
                Goods item_info = xc.GoodsHelper.ParseClientGoodsStr(idStr);
                if (item_info != null)
                {
                    GoodsHelper.ShowGoodsTips(item_info, null, null, "GuildWarehouseNormal");
                }
                else
                {
                    GameDebug.LogError("playerId param is error! idStr = " + idStr);
                }
            }
            else if (origText.Contains("enter_guild_manor"))
            {//进入帮派领地
                if (SysConfigManager.GetInstance().CheckSysHasOpened(GameConst.SYS_OPEN_GUILD, true))
                {
                    if (LocalPlayerManager.Instance.GuildID > 0)
                    {
                        InstanceHelper.EnterGuildManor();
                    }
                    else
                    {
                        xc.UINotice.Instance.ShowMessage(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_77"));
                        xc.ui.ugui.UIManager.GetInstance().ShowSysWindow("UIGuildWindow");
                    }
                }
            }
            else if (origText.Contains("goodsTips"))
            {//查看物品
                string idStr  = origText.Replace("goodsTips=", "");
                var    matchs = Regex.Matches(idStr, @"\{(\d+),(\d+)\}");
                foreach (Match _match in matchs)
                {
                    if (_match.Success)
                    {
                        uint             sendId   = (DBTextResource.ParseUI(_match.Groups[1].Value));
                        ulong            goodsOid = DBTextResource.ParseUL_s(_match.Groups[2].Value, 0);
                        Net.C2STalkGoods pack     = new Net.C2STalkGoods();
                        pack.uuid = sendId;
                        pack.oid  = goodsOid;
                        //GameDebug.LogError("===============  OnClickHref test");
                        Net.NetClient.GetBaseClient().SendData <Net.C2STalkGoods>(xc.protocol.NetMsg.MSG_TALK_GOODS, pack);
                    }
                }
            }
            else if (origText.Contains("goodsGid"))
            {
                var matchs = Regex.Matches(origText, @"goodsGid=\{(\d+),(\d+)\}");
                foreach (Match _match in matchs)
                {
                    if (_match.Success)
                    {
                        //uint playerId = (DBTextResource.ParseUI(_match.Groups[1].Value));
                        uint goodsGid = DBTextResource.ParseUI(_match.Groups[2].Value);

                        var goods = GoodsHelper.CreateGoodsByTypeId(goodsGid);
                        if (goods != null)
                        {
                            GoodsHelper.ShowGoodsTips(goods);
                        }
                    }
                }
            }
            else if (origText.Contains("position="))
            {
                var matchs = Regex.Matches(origText, @"position=\{(\d+),(\d+),(\d+\.?\d*),(\d+\.?\d*)\}");

                foreach (Match _match in matchs)
                {
                    if (_match.Success)
                    {
                        uint  instanceId = DBTextResource.ParseUI(_match.Groups[1].Value);
                        uint  line       = DBTextResource.ParseUI(_match.Groups[2].Value);
                        float x          = DBTextResource.ParseF(_match.Groups[3].Value);
                        float z          = DBTextResource.ParseF(_match.Groups[4].Value);

                        ClientEventMgr.GetInstance().FireEvent(
                            (int)ClientEvent.CE_CHAT_JUMP_TO_CONST_POSITION,
                            new CEventEventParamArgs(instanceId, line, x, z));
                    }
                }
            }
            else if (origText.Contains("marketGoodsTips"))
            {
                var matchs = Regex.Matches(origText, @"marketGoodsTips=\{(\d+)\}");
                foreach (Match _match in matchs)
                {
                    if (_match.Success)
                    {
                        uint goodsOid            = DBTextResource.ParseUI(_match.Groups[1].Value);
                        Net.C2SMarketDetail pack = new Net.C2SMarketDetail();
                        pack.oid = goodsOid;

                        Net.NetClient.GetBaseClient().SendData <Net.C2SMarketDetail>(xc.protocol.NetMsg.MSG_MARKET_DETAIL, pack);
                    }
                }
            }
            else
            {
                ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_CHAT_RESPONSE_CLICK_TEXT_HREF, new CEventEventParamArgs(origText));
            }
        }