コード例 #1
0
        LevelExpInfo GetItemInfo(uint lv)
        {
            string query  = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "lv", lv);
            var    reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query);

            if (reader == null)
            {
                mLevelInfos[lv] = null;
                return(null);
            }

            if (!reader.HasRows || !reader.Read())
            {
                mLevelInfos[lv] = null;

                reader.Close();
                reader.Dispose();
                return(null);
            }

            LevelExpInfo info = new LevelExpInfo();

            info.Level      = lv;
            info.Exp        = DBTextResource.ParseUL_s(GetReaderString(reader, "exp"), 0);
            info.SkillScore = DBTextResource.ParseUI(GetReaderString(reader, "skill_score"));

            mLevelInfos.Add(info.Level, info);

            reader.Close();
            reader.Dispose();
            return(info);
        }
コード例 #2
0
        public DBGuildTotemItem GetOneItem(uint lv)
        {
            DBGuildTotemItem info;

            if (mInfos.TryGetValue(lv, out info))
            {
                return(info);
            }

            string query  = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "lv", lv);
            var    reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query);

            if (reader == null)
            {
                mInfos[lv] = null;
                return(null);
            }

            if (!reader.HasRows || !reader.Read())
            {
                mInfos[lv] = null;

                reader.Close();
                reader.Dispose();
                return(null);
            }

            info = new DBGuildTotemItem();

            info.Lv              = DBTextResource.ParseUI_s(GetReaderString(reader, "lv"), 0);
            info.Exp             = DBTextResource.ParseUL_s(GetReaderString(reader, "exp"), 0);
            info.Buffs           = DBTextResource.ParseArrayUint(GetReaderString(reader, "buffs"), ",");
            info.Descs           = DBTextResource.ParseArrayString(GetReaderString(reader, "descs"));
            info.NextOffsetDescs = DBTextResource.ParseArrayString(GetReaderString(reader, "next_offset_descs"));

            mInfos.Add(info.Lv, info);

            reader.Close();
            reader.Dispose();
            return(info);
        }
コード例 #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));
            }
        }