Ejemplo n.º 1
0
        /// <summary>
        /// 초기지급 에너지 설정
        /// </summary>
        public void FirstSupply()
        {
            Items.Clear();
            foreach (var data in Codes.Energy.Items)
            {
                Data energy = new Data(_user, data.Value.EnergyId);
                Items.Add(energy);
            }

            //  Insert to DB
            using (var cmd = GameDB.NewCommand(_user.UserNo))
            {
                Int32 idx = 0;

                cmd.CommandText.Append("insert into t_userinfo_energy values");
                foreach (var energy in Items)
                {
                    cmd.CommandText.AppendFormat("(@{0}, @{1}, @{2}, @{3}),", idx + 0, idx + 1, idx + 2, idx + 3);
                    cmd.BindParameter(String.Format("@{0}", idx + 0), _user.UserNo);
                    cmd.BindParameter(String.Format("@{0}", idx + 1), energy.EnergyId);
                    cmd.BindParameter(String.Format("@{0}", idx + 2), energy.Point);
                    cmd.BindParameter(String.Format("@{0}", idx + 3), energy.LastUpdateTime);
                    idx += 4;
                }
                cmd.CommandText[cmd.CommandText.Length - 1] = ';';
                cmd.PostQueryNoReader();
            }
        }
Ejemplo n.º 2
0
        public Data AddResource(Int32 resourceId, Int32 point)
        {
            Data resource = new Data(resourceId);
            resource.Point = point;
            Items.Add(resource);

            using (var cmd = GameDB.NewCommand(_user.UserNo))
            {
                cmd.CommandText.Append("insert into t_userinfo_resource values(@0, @1, @2);");
                cmd.BindParameter("@0", _user.UserNo);
                cmd.BindParameter("@1", resourceId);
                cmd.BindParameter("@2", point);
                cmd.PostQueryNoReader();
            }

            return resource;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 초기지급 리소스 설정
        /// </summary>
        public void FirstSupply()
        {
            Items.Clear();
            foreach (var data in GameData.FirstSupply.ResourceData.Items)
            {
                Data resource = new Data(data.ResourceId);
                resource.Point = data.Point;
                Items.Add(resource);
            }

            //  Insert to DB
            using (var cmd = GameDB.NewCommand(_user.UserNo))
            {
                Int32 idx = 0;

                cmd.CommandText.Append("insert into t_userinfo_resource values");
                foreach (var energy in Items)
                {
                    cmd.CommandText.AppendFormat("(@{0}, @{1}, @{2}),", idx + 0, idx + 1, idx + 2);
                    cmd.BindParameter(String.Format("@{0}", idx + 0), _user.UserNo);
                    cmd.BindParameter(String.Format("@{0}", idx + 1), energy.ResourceId);
                    cmd.BindParameter(String.Format("@{0}", idx + 2), energy.Point);
                    idx += 3;
                }
                cmd.CommandText[cmd.CommandText.Length - 1] = ';';
                cmd.PostQueryNoReader();
            }
        }