示例#1
0
    public void WakeUp(HeadRole role)
    {
        int          id = pop.curView.data.starData.g_csv_id + 1;
        RoleStarData r  = GameShared.Instance.GetRoleStarById(id);

        if (!role.data.is_possessed)
        {
            r = GameShared.Instance.GetRoleStarById(pop.curView.data.starData.g_csv_id);
        }

        if (pop.curView.data.wakeLevel >= Def.WakeLevelMax)
        {
            ToastManager.Instance.Show("达到最大等级");
        }
        else if (pop.curView.data.frgNum < r.us_prop_num)
        {
            ToastManager.Instance.Show("碎片不够");
        }
        else if (pop.curView.data.is_possessed)
        {
            C2sSprotoType.role_upgrade_star.request obj = new C2sSprotoType.role_upgrade_star.request();
            obj.role_csv_id         = pop.curView.data.csv_id;
            pop.UpWakeBtn.isEnabled = false;
            NetworkManager.Instance.RoleWake(obj);
        }
        else
        {
            C2sSprotoType.role_recruit.request obj = new C2sSprotoType.role_recruit.request();
            obj.csv_id = pop.curView.data.csv_id;
            pop.UpWakeBtn.isEnabled = false;
            NetworkManager.Instance.RoleRecruit(obj);
        }
    }
示例#2
0
    /// <summary>
    /// 升级后角色属性
    /// </summary>
    /// <param name="r"></param>
    /// <returns></returns>
    public RoleStarData GetUpLevelRoleAttr(RoleData r)
    {
        int          id       = (r.csv_id * 1000) + r.wakeLevel + 1;
        RoleStarData starData = GameShared.Instance.GetRoleStarById(id);

        return(starData);
    }
示例#3
0
    /// <summary>
    /// 升级后角色战斗属性
    /// </summary>
    /// <param name="r"></param>
    /// <returns></returns>
    public float GetBattleRoleUPAttrByType(int type)
    {
        RoleData     r = pop.GetCurView().data;
        RoleStarData s = GetUpLevelRoleAttr(r);

        return(s.battleAddition[type]);
    }
示例#4
0
    //角色升星
    public Hashtable QueryRoleStarTable()
    {
        InitDB();
        Hashtable        table    = new Hashtable();
        SqliteDataReader sqReader = db.ReadFullTable("g_role_star");

        while (sqReader.Read())
        {
            RoleStarData role = new RoleStarData();
            role.csv_id           = sqReader.GetInt32(sqReader.GetOrdinal("csv_id"));
            role.g_csv_id         = sqReader.GetInt32(sqReader.GetOrdinal("g_csv_id"));
            role.us_prop_num      = sqReader.GetInt32(sqReader.GetOrdinal("us_prop_num"));
            role.us_prop_csv_id   = sqReader.GetInt32(sqReader.GetOrdinal("us_prop_csv_id"));
            role.star_init        = sqReader.GetInt32(sqReader.GetOrdinal("star_init"));
            role.sharp            = sqReader.GetInt32(sqReader.GetOrdinal("sharp"));
            role.name             = sqReader.GetString(sqReader.GetOrdinal("name"));
            role.anim             = sqReader.GetString(sqReader.GetOrdinal("anim"));
            role.strs             = sqReader.GetString(sqReader.GetOrdinal("strs"));
            role.skill_csv_id     = sqReader.GetInt32(sqReader.GetOrdinal("skill_csv_id"));
            role.gather_buffer_id = sqReader.GetInt32(sqReader.GetOrdinal("gather_buffer_id"));
            role.battle_buffer_id = sqReader.GetInt32(sqReader.GetOrdinal("battle_buffer_id"));
            table.Add(role.g_csv_id, role);
        }
        return(table);
    }
示例#5
0
    public Dictionary <int, RoleStarData> QueryRoleFragmentTable()
    {
        InitDB();
        SqliteDataReader sqReader = db.ExecuteQuery("SELECT * FROM g_role JOIN g_role_star ON g_role.us_prop_csv_id=g_role_star.us_prop_csv_id WHERE g_role.star == g_role_star.star");
        //SqliteDataReader sqReader = db.ReadFullTable("g_equipment_enhance");
        Dictionary <int, RoleStarData> table = new Dictionary <int, RoleStarData>();

        while (sqReader.Read())
        {
            RoleStarData role = new RoleStarData();
            role.csv_id           = sqReader.GetInt32(sqReader.GetOrdinal("csv_id"));
            role.g_csv_id         = sqReader.GetInt32(sqReader.GetOrdinal("g_csv_id"));
            role.us_prop_num      = sqReader.GetInt32(sqReader.GetOrdinal("us_prop_num"));
            role.us_prop_csv_id   = sqReader.GetInt32(sqReader.GetOrdinal("us_prop_csv_id"));
            role.star_init        = sqReader.GetInt32(sqReader.GetOrdinal("star_init"));
            role.sharp            = sqReader.GetInt32(sqReader.GetOrdinal("sharp"));
            role.name             = sqReader.GetString(sqReader.GetOrdinal("name"));
            role.anim             = sqReader.GetString(sqReader.GetOrdinal("anim"));
            role.strs             = sqReader.GetString(sqReader.GetOrdinal("strs"));
            role.skill_csv_id     = sqReader.GetInt32(sqReader.GetOrdinal("skill_csv_id"));
            role.gather_buffer_id = sqReader.GetInt32(sqReader.GetOrdinal("gather_buffer_id"));
            role.battle_buffer_id = sqReader.GetInt32(sqReader.GetOrdinal("battle_buffer_id"));
            table.Add(role.us_prop_csv_id, role);
        }
        return(table);
    }
示例#6
0
    public RoleStarData GetRoleInfoByFragment(int id)
    {
        RoleStarData r = null;

        if (roleFragment.ContainsKey(id))
        {
            r = roleFragment[id];
        }
        return(r);
    }
示例#7
0
    /// <summary>
    /// 升级后角色收集属性
    /// </summary>
    /// <param name="r"></param>
    /// <returns></returns>
    public float GetCollectRoleUPAttrByType(int type)
    {
        RoleData     r   = pop.GetCurView().data;
        RoleStarData s   = GetUpLevelRoleAttr(r);
        float        num = 0;

        if (s != null)
        {
            num = s.additionArr[type];
        }
        return(num);
    }
示例#8
0
 //处理 角色表的 buff 数值填进去
 public void InitRoleStarTableData()
 {
     System.Collections.IDictionaryEnumerator enumerator = roleStarTable.GetEnumerator();
     while (enumerator.MoveNext())
     {
         RoleStarData r  = roleStarTable[enumerator.Key] as RoleStarData;
         BuffData     b1 = GameShared.Instance.GetBuffById(r.gather_buffer_id);
         b1.GetBuffAttr();
         r.attrArr     = b1.attrArr;
         r.additionArr = b1.additionArr;
         BuffData b2 = GameShared.Instance.GetBuffById(r.battle_buffer_id);
         b2.GetBuffAttr();
         r.battleAttr     = b2.attrArr;
         r.battleAddition = b2.additionArr;
     }
 }
示例#9
0
    public void ChouCallback(C2sSprotoType.applydraw.response resp)
    {
        curChouView.abuyBtn.isEnabled = true;
        List <ItemViewData> list = new List <ItemViewData>();

        roleList = new List <RoleStarData>();
        if (resp.errorcode == 1)
        {
            if (resp.list != null)
            {
                for (int i = 0; i < resp.list.Count; i++)
                {
                    ItemViewData re = new ItemViewData();
                    re.curCount = (int)resp.list[i].propnum;
                    re.time     = (int)resp.lefttime;
                    re.isRole   = (int)resp.list[i].proptype;
                    re.data     = GameShared.Instance.GetItemData((int)resp.list[i].propid);
                    RoleStarData r = GameShared.Instance.GetRoleInfoByFragment((int)resp.list[i].propid);
                    Debug.Log("r.us_prop_csv_id" + resp.list[i].propid + "resp.list[i].proptype" + resp.list[i].proptype);
                    if (r != null && resp.list[i].proptype == 1)
                    {
                        roleList.Add(r);
                    }
                    list.Add(re);
                }

                if (pop.cur != null)
                {
                    if (pop.cur.data.id == 2)
                    {
                        pop.cur.data.isShowTime = true;
                        pop.cur.data.drawnum++;
                        if (pop.cur.data.drawnum > 1)
                        {
                            UserManager.Instance.SubDiamond(pop.cur.data.money);
                        }
                    }
                    else if (pop.cur.data.id == 1)
                    {
                        UserManager.Instance.SubFriendPoint(pop.cur.data.money);
                    }
                    else if (pop.cur.data.id == 3)
                    {
                        UserManager.Instance.SubDiamond(pop.cur.data.money);
                    }
                    pop.cur.data.lefttime = (int)list[0].time;
                    int a = (int)list[0].time;
                    pop.cur.data.drawnum++;
                    pop.cur.data.refresh_time = DateTime.Now.AddSeconds(a);
                    pop.cur.Check();
                    pop.cur = null;
                }
                if (list.Count > 0)
                {
                    OpenBiling(list);
                }
            }
            else
            {
                if (pop.cur.data.id > 1)
                {
                    MainUI.Instance.DiomandToClick();
                }
                else
                {
                    Debug.Log("好友点数不够");
                }
            }
        }
    }
示例#10
0
    public void SetRoleInfo(ref RoleData d)
    {
        float c     = 0;
        float cu    = 0;
        int   index = 0;

        d.frgNum = BagMgr.Instance.GetItemNumById(d.starData.us_prop_csv_id);
        for (int i = 0; i < pop.GetCurView().data.starData.additionArr.Length; i++)
        {
            c  = GetRoleCollectAttrByType(i);
            cu = GetCollectRoleUPAttrByType(i);
            if (c > 0)
            {
                index = i;
                break;
            }
        }
        string desc = GetAttrStr((Def.AttrId)index);

        pop.SetCollectDesc(desc);

        if (d.is_possessed == false)
        {
            int          id = (d.starData.csv_id * 1000) + 5;
            RoleStarData r  = GameShared.Instance.GetRoleStarById(id);
            float        a  = d.frgNum / (float)d.starData.us_prop_num;

            pop.SetRoleInfo(d,
                            (int)r.battleAddition[(int)Def.AttrType.FightPower] + "%满级",
                            (int)c + "%满级",
                            "",
                            "",
                            (int)a,
                            d.frgNum + "/" + d.starData.us_prop_num
                            );
            pop.SetArrowShow(false);
        }
        else if (d.wakeLevel >= Def.WakeLevelMax)
        {
            float a = d.frgNum / (float)d.starData.us_prop_num;
            pop.SetRoleInfo(d,
                            (int)GetRoleBattleAttrByType((int)Def.AttrType.FightPower) + "%满级",
                            (int)c + "%满级",
                            "",
                            "",
                            (int)a,
                            d.frgNum + "/" + d.starData.us_prop_num
                            );
            pop.SetArrowShow(false);
        }
        else
        {
            int          id = d.starData.g_csv_id + 1;
            RoleStarData r  = GameShared.Instance.GetRoleStarById(id);
            float        a  = d.frgNum / (float)r.us_prop_num;
            pop.SetRoleInfo(d,
                            (int)GetRoleBattleAttrByType((int)Def.AttrType.FightPower) + "%",
                            (int)c + "%",
                            (int)GetBattleRoleUPAttrByType((int)Def.AttrType.FightPower) + "%",
                            (int)cu + "%",
                            (int)a,
                            d.frgNum + "/" + r.us_prop_num
                            );
            pop.SetArrowShow(true);
        }
        string[] s = d.starData.strs.Split('*');
        pop.SetTalk(s[0]);
    }