/// <summary> /// 1104 0616 回应船长数据 /// </summary> public static bool Recv_USER_CAPTION_INFO_RESP(object Info) { if (Info == null) { return(false); } captain.CaptainInfoResponse sir = Info as captain.CaptainInfoResponse; foreach (captain.CaptainInfo I in sir.captain_infos) { //添加 int action = I.action; int id = I.captainid; if (action == 0) { bool ishave = false; foreach (CaptionInfo c in m_Captions.Values) { if (c.m_id == I.id) { ishave = true; c.SetCaption(I); break; } } if (ishave == false) { CaptionInfo capinfo = new CaptionInfo(); GodSkillM.GetCaption(I.captainid, ref capinfo); capinfo.SetCaption(I); m_Captions.Add(id, capinfo); } } else if (action == 1) //update { foreach (CaptionInfo c in m_Captions.Values) { if (c.m_id == I.id) { c.SetCaption(I); break; } } } else if (action == 2) { foreach (CaptionInfo c in m_Captions.Values) { if (c.m_id == I.id) { m_Captions.Remove(c.m_captionid); break; } } } } return(true); }
public void UpLevel() { if (MyHead.togUpLevel.value) { MyHead.UpStar.SetActive(false); MyHead.UpLevel.SetActive(true); MyHead.BtnUpStar.gameObject.SetActive(false); MyHead.btnUp.gameObject.SetActive(true); MyHead.LblNextName.text = NGUIUtil.GetStringByKey(10000154); //MyHead.btnUp.isEnabled = false; if (m_CurItem != null) { m_CurItem.ResetUI(); MyHead.LblStarName.text = ""; MyHead.lblName.text = "[71fff0]" + m_CurItem.Godskill.m_name + "[-] [ffff62]" + NGUIUtil.GetStringByKey("60000005") + m_CurItem.m_caption.m_level1 + "[-]"; if (m_CurItem.Godskill.m_coinneed == 0 && m_CurItem.Godskill.m_crystalneed == 0) { MyHead.lblExplain.text = NGUIUtil.GetStringByKey(10000122); } else { MyHead.lblExplain.text = string.Format("[552d0a]" + m_CurItem.Godskill.m_explain + "[-]"); } MyHead.lblGoldCost.text = m_CurItem.Godskill.m_coinneed.ToString(); if (UserDC.GetCoin() >= m_CurItem.Godskill.m_coinneed) { MyHead.lblGoldCost.color = Color.white; } else { MyHead.lblGoldCost.color = Color.red; } MyHead.lblDiamondCost.text = m_CurItem.Godskill.m_crystalneed.ToString(); if (UserDC.GetCrystal() >= m_CurItem.Godskill.m_crystalneed) { MyHead.lblDiamondCost.color = Color.white; } else { MyHead.lblDiamondCost.color = Color.red; } m_CurItem.CheckUp(); // MyHead.btnUp.isEnabled = m_CurItem.CheckLevTop() && m_CurItem.m_CanLevUP; GodSkillInfo nextInfo = new GodSkillInfo(); GodSkillM.GetGodSkill(m_CurItem.Godskill.m_type, m_CurItem.Godskill.m_level + 1, ref nextInfo); if (nextInfo != null && nextInfo.m_explain != null) { MyHead.NextStarDes.text = string.Format("[552d0a]" + nextInfo.m_explain + "[-]"); } } } }
/// <summary> /// 模拟数据 /// </summary> public static void SimulationData() { int id = 1; m_Captions.Clear(); List <CaptionInfo> l = GodSkillM.GetCaptions(); for (int i = 0; i < l.Count; i++) { l[i].m_id = id++; m_Captions.Add(l[i].m_id, l[i]); } }
public void UpStar() { if (MyHead.togUpStar.value) { MyHead.UpStar.SetActive(true); MyHead.UpLevel.SetActive(false); MyHead.BtnUpStar.gameObject.SetActive(true); MyHead.btnUp.gameObject.SetActive(false); MyHead.LblNextName.text = NGUIUtil.GetStringByKey(70000115); //MyHead.BtnUpStar.isEnabled = false; if (m_CurItem != null) { m_CurItem.ResetUI(); MyHead.LblStarName.text = "[71fff0]" + m_CurItem.Godskill.m_name + "[-]"; MyHead.lblName.text = ""; MyHead.lblExplain.text = string.Format("[552d0a]" + m_CurItem.Godskill.m_stardescription + "[-]"); int bookcount = ItemDC.GetItemCount(m_CurItem.Godskill.m_needbook); if (m_CurItem.Godskill.m_needbooknum == 0 && m_CurItem.m_caption.m_star == 5) { MyHead.lblScrollNum.text = NGUIUtil.GetStringByKey(10000085); MyHead.SprProgress.fillAmount = 1.0f; } else { MyHead.lblScrollNum.text = bookcount + "/" + m_CurItem.Godskill.m_needbooknum; MyHead.SprProgress.fillAmount = bookcount * 1.0f / m_CurItem.Godskill.m_needbooknum; } GodSkillInfo nextInfo = new GodSkillInfo(); GodSkillM.GetGodSkill(m_CurItem.Godskill.m_type, m_CurItem.Godskill.m_level, m_CurItem.m_caption.m_star + 1, ref nextInfo); if (m_CurItem.m_caption.m_star == 5) { MyHead.NextStarDes.text = string.Format("[552d0a]" + NGUIUtil.GetStringByKey(10000085) + "[-]"); } else if (nextInfo != null && nextInfo.m_stardescription != null) { MyHead.NextStarDes.text = string.Format("[552d0a]" + nextInfo.m_stardescription + "[-]"); } SetTrapStarLevel(m_CurItem.m_caption.m_star); m_CurItem.CheckUp(); // MyHead.BtnUpStar.isEnabled = m_CurItem.CheckStarTop(); UIGrid grid = MyHead.StarParent.GetComponent <UIGrid>(); grid.repositionNow = true; } } }
/// <summary> /// 从protobuf 解析静态数据到本地 /// </summary> /// <param name="msg"></param> public static void LoadStaticDataToLocal(sdata.StaticDataResponse msg) { ConfigM.Init(msg); buildingM.Init(msg); DeckM.Init(msg); UserM.Init(msg); SoldierM.Init(msg); SummonM.Init(msg); SkillM.Init(msg); StageM.Init(msg); RoleNameM.Init(msg); ItemM.Init(msg); GodSkillM.Init(msg); AthleticsM.Init(msg); ErnieM.Init(msg); FruitionM.Init(msg); ShipPlanM.Init(msg); }
private void SetUI() { if (ItemType == 1) { NGUIUtil.SetActive(MyHead.LblLevelNum.gameObject, true); NGUIUtil.SetActive(MyHead.GroupNumPercentage, false); NGUIUtil.Set2DSprite(MyHead.sprHead, "Textures/role/", m_caption.m_captionid.ToString()); } else if (ItemType == 0) { NGUIUtil.SetActive(MyHead.LblLevelNum.gameObject, false); NGUIUtil.SetActive(MyHead.lblLevelneed.gameObject, false); NGUIUtil.SetActive(MyHead.GroupNumPercentage, true); NGUIUtil.Set2DSpriteGraySV(MyHead.sprHead, "Textures/role/", m_caption.m_captionid.ToString()); int itemtype = Godskill.m_needbook; m_iHave = ItemDC.GetItemCount(itemtype); m_iNeed = GodSkillM.GetCaptainNeedBookNum(m_caption.m_captionid); float fillAmount = m_iHave / (m_iNeed * 1.0f); NGUIUtil.SetSpriteFillAmount(MyHead.SprNumPercentage, fillAmount); SetSummonNum(m_iHave, m_iNeed); } gameObject.name = m_caption.m_captionid.ToString(); if (MyHead.lblName) { MyHead.lblName.text = m_caption.m_GodSkill[m_caption.m_godskilltype1].m_name; } MyHead.sprCanUse.gameObject.SetActive(false); if (UserDC.GetLevel() < m_caption.m_levelneed) { MyHead.lblLevelneed.text = string.Format(NGUIUtil.GetStringByKey("60000004"), m_caption.m_levelneed.ToString()); MyHead.toggle.activeSprite.enabled = false; MyHead.LblLevelNum.gameObject.SetActive(false); MyHead.SprStarparent.SetActive(false); SetStarLevel(0); } else { CheckUp(); SetStarLevel(m_caption.m_star); } MyHead.LblLevelNum.text = Godskill.m_level.ToString(); }
/// <summary> /// 创建黑科技 /// </summary> void CreateBlackScience(CaptionInfo info) { if (info == null) { NGUIUtil.DebugLog("CreateBlackScience info == null"); return; } GodSkillInfo gInfo = new GodSkillInfo(); //黑科技抽取是1级,王振鑫确认 GodSkillM.GetGodSkill(info.m_godskilltype1, 1, ref gInfo); NGUIUtil.SetLableText(MyHead.LblBlackScienceDesc, gInfo.m_explain); string icon = "Textures/role/" + info.m_captionid; NGUIUtil.Set2DSprite(MyHead.Spr2dBSIcon, icon); int star = GodSkillM.GetCaptionMinStarLevel(info.m_godskilltype1); SetStarsLevel(star); }
/// <summary> /// 获取有碎片(尚未召唤)黑科技 /// </summary> public static void GetHaveFragmentBS(ref List <CaptionInfo> l) { if (l == null) { l = new List <CaptionInfo>(); } l.Clear(); l = GodSkillM.GetCaptions(); for (int i = l.Count - 1; i >= 0; i--) { CaptionInfo info = l[i]; int itemtype = info.GetGodSkillInfo().m_needbook; int have = ItemDC.GetItemCount(itemtype); if (CheckHaveBS(info.m_captionid) || have == 0) { l.RemoveAt(i); } } }
public void SetCaption(CaptainInfo info) { m_id = info.id > 0 ? info.id : m_id; m_star = info.star > 0? info.star : m_star; m_level1 = info.level1 > 0? info.level1 : m_level1; m_godskilltype1 = info.godskilltype1 > 0? info.godskilltype1 : m_godskilltype1; GodSkillInfo skill = new GodSkillInfo(); if (m_godskilltype1 > 0 && m_level1 > 0) { GodSkillM.GetGodSkill(m_godskilltype1, m_level1, m_star, ref skill); m_GodSkill[m_godskilltype1] = skill; } skill = new GodSkillInfo(); if (info.godskilltype2 > 0 && info.level2 > 0) { m_level2 = info.level2; m_godskilltype2 = info.godskilltype2; GodSkillM.GetGodSkill(info.godskilltype2, info.level2, info.star, ref skill); m_GodSkill[info.godskilltype2] = skill; } skill = new GodSkillInfo(); if (info.godskilltype3 > 0 && info.level3 > 0) { m_level3 = info.level3; m_godskilltype3 = info.godskilltype3; GodSkillM.GetGodSkill(info.godskilltype3, info.level3, info.star, ref skill); m_GodSkill[info.godskilltype3] = skill; } skill = new GodSkillInfo(); if (info.godskilltype4 > 0 && info.level4 > 0) { m_level4 = info.level4; m_godskilltype4 = info.godskilltype4; GodSkillM.GetGodSkill(info.godskilltype4, info.level4, info.star, ref skill); m_GodSkill[info.godskilltype4] = skill; } }
/// <summary> /// 显示首次获得黑科技表现 /// </summary> private void ShowTrophiesAction() { if (CurSummonCaptianID == 0) { return; } CaptionInfo cInfo = new CaptionInfo(); GodSkillM.GetCaption(CurSummonCaptianID, ref cInfo); GodSkillInfo gInfo = new GodSkillInfo(); //黑科技抽取是1级,王振鑫确认 GodSkillM.GetGodSkill(cInfo.m_godskilltype1, 1, ref gInfo); string name = ""; name = gInfo.m_name; sdata.s_itemtypeInfo itypeInfo = new sdata.s_itemtypeInfo(); itypeInfo.gid = CurSummonCaptianID; itypeInfo.name = name; itypeInfo.gtype = 3; List <sdata.s_itemtypeInfo> lInfo = new List <sdata.s_itemtypeInfo>(); lInfo.Add(itypeInfo); TrophiesActionWnd TropWnd = WndManager.GetDialog <TrophiesActionWnd>(); if (TropWnd) { TropWnd.ClearTropiesData(); TropWnd.AddTropiesData(lInfo); TropWnd.SetWndType(3); TropWnd.MyHead.LblDes.gameObject.SetActive(false); } }
public void SetCaption(int level) { GodSkillInfo skill = new GodSkillInfo(); m_level1 = level; m_level2 = level; m_level3 = level; m_level4 = level; if (m_godskilltype1 > 0) { if (m_star == 0) { m_star = 1; } GodSkillM.GetGodSkill(m_godskilltype1, level, m_star, ref skill); if (m_GodSkill.ContainsKey(m_godskilltype1)) { m_GodSkill[m_godskilltype1] = skill; } else { m_GodSkill.Add(m_godskilltype1, skill); } } skill = new GodSkillInfo(); if (m_godskilltype2 > 0) { GodSkillM.GetGodSkill(m_godskilltype2, level, m_star, ref skill); if (m_GodSkill.ContainsKey(m_godskilltype2)) { m_GodSkill[m_godskilltype2] = skill; } else { m_GodSkill.Add(m_godskilltype2, skill); } } skill = new GodSkillInfo(); if (m_godskilltype3 > 0) { GodSkillM.GetGodSkill(m_godskilltype3, level, m_star, ref skill); if (m_GodSkill.ContainsKey(m_godskilltype3)) { m_GodSkill[m_godskilltype3] = skill; } else { m_GodSkill.Add(m_godskilltype3, skill); } } skill = new GodSkillInfo(); if (m_godskilltype4 > 0) { GodSkillM.GetGodSkill(m_godskilltype4, level, m_star, ref skill); if (m_GodSkill.ContainsKey(m_godskilltype4)) { m_GodSkill[m_godskilltype4] = skill; } else { m_GodSkill.Add(m_godskilltype4, skill); } } }
// isSoul是为了兼容闪亮登场界面的信息。 public static ItemIconInfo GetIconInfo(IconType iconType, int id, bool isSoul, bool isBook) { ItemIconInfo iconInfo = new ItemIconInfo(); if (iconType == IconType.IconType_Fragment) { if (isSoul) { int soldierTypeId = SoldierM.GetSoldierStarID(id); s_soldier_typeInfo info = SoldierM.GetSoldierType(soldierTypeId); if (info == null) { NGUIUtil.DebugLog("s_soldiertype id = " + id + " 静态表数据未配置!"); return(null); } else { iconType = IconType.IconType_Soldier; id = info.modeltype; } } else if (isBook) { iconType = IconType.IconType_Captain; int godSkillType = GodSkillM.GetGodSkillType(id); id = GodSkillM.GetCaptainID(godSkillType); } } if (iconType == IconType.IconType_Soldier) //英雄整卡 { s_soldier_typeInfo info = SoldierM.GetSoldierType(id); if (info == null) { NGUIUtil.DebugLog("s_soldiertype id = " + id + " 静态表数据未配置!"); return(null); } else { iconInfo.mType = iconType; iconInfo.mName = info.name; iconInfo.mID = info.modeltype; } } else if (iconType == IconType.IconType_Fragment) //道具/碎片 { s_itemtypeInfo info = ItemM.GetItemInfo(id); if (info == null) { NGUIUtil.DebugLog("s_itemtype id = " + id + " 静态表数据未配置!"); return(null); } else { iconInfo.mType = iconType; iconInfo.mName = info.name; int soldierTypeId = SoldierM.GetSoldierStarID(id); iconInfo.mID = info.gid; } } else if (iconType == IconType.IconType_Bulding) //陷阱 { s_building_typeInfo buildinfo = buildingM.GetBuildType(id); iconInfo.mType = iconType; iconInfo.mName = buildinfo.name; iconInfo.mID = buildinfo.modeltype; } else if (iconType == IconType.IconType_Captain) //黑科技 { iconInfo.mType = iconType; CaptionInfo captionInfo = new CaptionInfo(); GodSkillM.GetCaption(id, ref captionInfo); GodSkillInfo godSkillInfo = new GodSkillInfo(); GodSkillM.GetGodSkill(captionInfo.m_godskilltype1, 1, ref godSkillInfo); iconInfo.mName = godSkillInfo.m_name; iconInfo.mID = id; } iconInfo.mIsSoul = isSoul; iconInfo.mIsBook = isBook; return(iconInfo); }
private void LoadTrophies(int gtype, int gid, bool isSoul = false, bool isNewVersion = false, int num = 0, bool isBook = false) { NGUIUtil.SetActive(MyHead.SkillInfo, false); NGUIUtil.SetActive(MyHead.Building, false); if (isNewVersion) { if (MyHead.LblDes != null) { MyHead.LblDes.gameObject.SetActive(false); } } if (gtype == 1) //炮弹兵 { SoldierInfo Info = SoldierM.GetStartSoldierInfo(gid); CreateSoldier(Info); if (isNewVersion) { if (isSoul && num > 0) { int startLevel = SoldierM.GetSoldierStarLevel(Info.SoldierTypeID); MyHead.LblDes.text = string.Format(NGUIUtil.GetStringByKey(10000119), startLevel, num); MyHead.LblDes.gameObject.SetActive(true); } } else if (m_isSoulPis && m_SoulPisNum > 0) { int startLevel = SoldierM.GetSoldierStarLevel(Info.SoldierTypeID); MyHead.LblDes.text = string.Format(NGUIUtil.GetStringByKey(10000119), startLevel, m_SoulPisNum); } m_bNotTween = false; } else if (gtype == 3) // 陷阱/建筑物 { BuildInfo Info = buildingM.GetStartBuildInfo(gid); if (Info != null) { CreateBuilding(Info); } m_bNotTween = true; } else if (gtype == 4) //黑科技 { NGUIUtil.SetActive(MyHead.BlackScience, true); CaptionInfo info = new CaptionInfo(); GodSkillM.GetCaption(gid, ref info); CreateBlackScience(info); if (isNewVersion) { if (isBook && num > 0) { int star = GodSkillM.GetCaptionMinStarLevel(info.m_godskilltype1); MyHead.LblDes.text = string.Format(NGUIUtil.GetStringByKey(30000060), star, num); MyHead.LblDes.gameObject.SetActive(true); } } else if (m_isSoulPis && m_SoulPisNum > 0) { int star = GodSkillM.GetCaptionMinStarLevel(info.m_godskilltype1); MyHead.LblDes.text = string.Format(NGUIUtil.GetStringByKey(30000060), star, m_SoulPisNum); } m_bNotTween = true; } else if (gtype == 5) //设计图 { StaticShipCanvas cInfo = ShipPlanM.GetShipCanvasInfo(gid); CreateDesignPic(cInfo); m_bNotTween = true; } else if (gtype == 2) //碎片 { CreateTrophyItem(gtype, gid); } SoundPlay.Play("get_item", false, false); }
private string GetName(s_signinInfo info) { string result = ""; int id = info.item_type; SignInRewardType type = (SignInRewardType)info.reward_type; switch (type) { case SignInRewardType.BlackScience: CaptionInfo cInfo = new CaptionInfo(); GodSkillM.GetCaption(id, ref cInfo); GodSkillInfo gInfo = new GodSkillInfo(); GodSkillM.GetGodSkill(cInfo.m_godskilltype1, 1, ref gInfo); result = gInfo.m_name; break; case SignInRewardType.HeroSoulFragment: case SignInRewardType.ItemAndEquip: case SignInRewardType.TrapFragment: case SignInRewardType.BlackScienceFragment: s_itemtypeInfo info1 = ItemM.GetItemInfo(id); if (info1 != null) { result = info1.name; } break; case SignInRewardType.Hero: SoldierInfo info2 = SoldierM.GetSoldierInfo(id); if (info2 != null) { result = info2.m_name; } break; case SignInRewardType.Trap: BuildInfo info3 = buildingM.GetStartBuildInfo(id); if (info3 != null) { result = info3.m_name; } break; case SignInRewardType.GoldCoin: result = NGUIUtil.GetStringByKey(88800061); break; case SignInRewardType.Diamond: result = NGUIUtil.GetStringByKey(99700001); break; case SignInRewardType.Crystal: result = NGUIUtil.GetStringByKey(10000177); break; case SignInRewardType.Wood: result = NGUIUtil.GetStringByKey(10000178); break; } return(result); }