BaseGem CreateGem( int x, int y, GemData type, Vector3 worldPosition, float delay ) { return(CreateGem(x, y, type, worldPosition, delay, out float _)); }
public void ReFreshGemInfo() { clearGemInfo(); int nEquipMax = (int)EquipPackSlot.Slot_NUM; int nGemMax = (int)GemLogic.CONSTVALUE.GEM_SLOT_NUM; GemData gemdata = GameManager.gameManager.OtherPlayerData.GemData; for (int eIndex = 0; eIndex < nEquipMax; ++eIndex) { for (int gIndex = 0; gIndex < nGemMax; ++gIndex) { int nListIndex = GetIndexByEquipSlot(eIndex) * nGemMax + gIndex; int nGemID = gemdata.GetGemId(eIndex, gIndex); if (nGemID >= 0) { Tab_CommonItem line = TableManager.GetCommonItemByID(nGemID, 0); if (line != null && nListIndex >= 0 && nListIndex < m_GemsInEquips.Length) { m_GemsInEquips[nListIndex].gameObject.SetActive(true); m_GemsInEquips[nListIndex].spriteName = line.Icon; } } } } }
public override void fullfillByNetwork(BaseResponse response) { if (response != null && response.status != BaseResponse.ERROR) { LoginResponse loginResp = response as LoginResponse; if (loginResp != null && loginResp.data != null) { GemInfo[] gemList = loginResp.data.gems; if (gemList != null) { //clear dirty data BagOfGems.Clear(); Core.Data.AccountMgr.clearBagStatus(ConfigDataType.Gems); GemData gd = null; foreach (GemInfo gi in gemList) { if (gi != null && ConfigData.TryGetValue(gi.num, out gd)) { Gems gm = new Gems(gd); gm.id = gi.id; BagOfGems.Add(gi.id, gm); gm.isNew = Core.Data.AccountMgr.getStatus(gm.id) == BagOfStatus.STATUS_NEW; //加入统计 Core.Data.AccountMgr.analyseBag(ConfigDataType.Gems, gi.id); } } } } } }
/// <summary> /// 更新宝石槽位 /// </summary> public void UpdateGemSlot() { GemData gemdata = GameManager.gameManager.OtherPlayerData.GemData; for (int i = 0; i < (int)CONSTVALUE.GEM_SLOT_NUM; i++) { m_GemSlotId[i] = gemdata.GetGemId(m_CurEquipSlot, i); } for (int i = 0; i < (int)CONSTVALUE.GEM_SLOT_NUM; i++) { if (m_GemSlotId[i] >= 0) { Tab_CommonItem line = TableManager.GetCommonItemByID(m_GemSlotId[i], 0); if (line != null) { m_GemSlotSprite[i].gameObject.SetActive(true); m_GemSlotSprite[i].spriteName = line.Icon; m_GemItemQualitySprite[i].gameObject.SetActive(true); m_GemItemQualitySprite[i].spriteName = GlobeVar.QualityColorGrid[line.Quality - 1]; } } else { m_GemSlotSprite[i].gameObject.SetActive(false); m_GemItemQualitySprite[i].gameObject.SetActive(false); } } //================ string name = GetCurEquipIcon(m_CurEquipSlot); m_CurEquipIcon.gameObject.SetActive(true); m_CurEquipIcon.spriteName = name; WriteGemDes(); }
public OtherPlayerData() { m_oEquipPack = new GameItemContainer(GameItemContainer.SIZE_EQUIPPACK, GameItemContainer.Type.TYPE_EQUIPPACK); //宝石 m_GemData = new GemData(); m_GemData.CleanUp(); }
public void HttpRespGemExChange(BaseHttpRequest request, BaseResponse response) { ComLoading.Close(); if (response.status != BaseResponse.ERROR) { HttpRequest rq = request as HttpRequest; if (rq.Type == RequestType.GEM_EXCHANGE) { GemExChangeResponse resp = response as GemExChangeResponse; GemData tempdata = Core.Data.gemsManager.getGemData(resp.data.pid); if (tempdata != null) //if(Core.Data.gemsManager.gemPriceConfig.ContainsKey(resp.data.pid)) { int price = tempdata.price; Debug.Log("Price:" + price); GemDebrisCountInBag -= price; //view.SetGemDebrisNum(GemDebrisCountInBag); } GetGemSucUI.OpenUI(Core.Data.gemsManager.getGems(resp.data.ppid).configData, view.TEXT(9014)); } } else { SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getNetworkErrorString(response.errorCode)); } }
//计算宝石成功率 public void CalculateSucessRate() { if (Selected_Frist_GemData != null && Selected_Second_GemData != null) { int uplevel = Selected_Frist_GemData.configData.target; GemData upGem = Core.Data.gemsManager.getGemData(uplevel); int NeedStone = 0; NeedCoin = 0; if (upGem != null) { SyntheticSucessRate = upGem.probability + SelectedMouldNum * 5; NeedCoin = upGem.coin; NeedStone = upGem.stone; //显示要升级的宝石的信息 view.ShowTargetGemInfo(upGem); } if (SyntheticSucessRate > 100f) { SyntheticSucessRate = 100f; } view.SetScuessRate(SyntheticSucessRate); CalculateMoney(defaultNum, NeedCoin, NeedStone); // view.SetNeedCoin(NeedCoin); // view.SetNeedStone(NeedStone); } else { view.ShowTargetGemInfo(null); } }
/*从服务器接收返回值,处理宝石合成 * */ public void SyntheticGem(BaseHttpRequest req, BaseResponse response) { if (response != null && response.status != BaseResponse.ERROR) { GemSyntheitcResponse param = response as GemSyntheitcResponse; /*如果没有保底 * */ if (param.data.succ == 1) { /*删除合成掉的宝石 * */ if (BagOfGems.ContainsKey(param.data.delId)) { int num = BagOfGems[param.data.delId].configData.ID; BagOfGems.Remove(param.data.delId); //删除统计 Core.Data.AccountMgr.setStatus(new BagOfStatus(param.data.delId, num, BagOfStatus.STATUS_DELETE)); } /*升级/降级宝石 * */ if (BagOfGems.ContainsKey(param.data.upId)) { GemData gd = null; ConfigData.TryGetValue(param.data.armNum, out gd); Gems gm = new Gems(gd); gm.id = param.data.upId; BagOfGems[param.data.upId] = gm; } } else { if (BagOfGems.ContainsKey(param.data.delId)) { BagOfGems.Remove(param.data.delId); } } Core.Data.playerManager.RTData.curStone += param.data.stone; Core.Data.playerManager.RTData.curCoin += param.data.coin; /*用掉宝石模具 * */ Item it = Core.Data.itemManager.GetBagItem(param.data.fpid); if (it != null) { it.RtData.count -= param.data.nm; /*如果数量为0,直接从背包中删除 * */ if (it.RtData.count <= 0) { Core.Data.itemManager.RemoveBagItem(param.data.fpid); } } } }
void SetIconDetail(UISprite _sprite, int id, UILabel _label, UISprite[] star) { int starcount = 0; if (DataCore.getDataType(id) == ConfigDataType.Monster) { AtlasMgr.mInstance.SetHeadSprite(_sprite, id.ToString()); MonsterData data = Core.Data.monManager.getMonsterByNum(id); _label.text = data.name; starcount = Core.Data.monManager.getMonsterByNum(id).star; SetStar(star, starcount); return; } else if (DataCore.getDataType(id) == ConfigDataType.Equip) { EquipData data = Core.Data.EquipManager.getEquipConfig(id); _sprite.atlas = AtlasMgr.mInstance.equipAtlas; _label.text = data.name; starcount = data.star; _sprite.spriteName = id.ToString(); } else if (DataCore.getDataType(id) == ConfigDataType.Gems) { GemData data = Core.Data.gemsManager.getGemData(id); _sprite.atlas = AtlasMgr.mInstance.commonAtlas; _label.text = data.name; starcount = data.star; _sprite.spriteName = data.anime2D.ToString(); _sprite.MakePixelPerfect(); SetStar(star, starcount); return; } else if (DataCore.getDataType(id) == ConfigDataType.Item) { ItemData data = Core.Data.itemManager.getItemData(id); _sprite.atlas = AtlasMgr.mInstance.itemAtlas; _sprite.spriteName = data.iconID.ToString(); _label.text = data.name; starcount = data.star; } else if (DataCore.getDataType(id) == ConfigDataType.Frag) { SoulData data = Core.Data.soulManager.GetSoulConfigByNum(id); AtlasMgr.mInstance.SetHeadSprite(_sprite, data.updateId.ToString()); _label.text = data.name; starcount = data.star; _sprite.spriteName = data.updateId.ToString(); SetStar(star, starcount); return; } else { RED.LogWarning("unknow reward type"); } SetStar(star, starcount); }
// ---------------------------------------------------------------- // Serializing // ---------------------------------------------------------------- override public PropData ToData() { GemData data = new GemData { pos = pos, type = type, travelMind = new TravelMindData(travelMind), }; return(data); }
/// <summary> /// Sets the get gem data. /// </summary> /// <value>The get gem data.</value> public GemData getGemData(int num) { GemData data = null; if (!ConfigData.TryGetValue(num, out data)) { data = null; } return(data); }
void CalculateMoney(int GemNum) { if (GemNum >= 1) { GemData upGem = Core.Data.gemsManager.getGemData(targetGemLevel); int NeedCoin = upGem.coin; int NeedStone = upGem.stone; coinNum = NeedCoin * GemNum; stoneNum = NeedStone * GemNum; } }
bool CanPress(int selectNum) { if (Selected_Frist_GemData != null && Selected_Second_GemData != null) { //宝石不足 int maxDNum = Core.Data.gemsManager.getSameGemCount(Selected_Frist_GemData); if (maxDNum % 2 != 0) { maxDNum = (maxDNum - 1) / 2; } else { maxDNum /= 2; } if (selectNum > maxDNum) { SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getString(7392)); return(false); } // 模具 不足 if (selectNum * SelectedMouldNum > GemMouldNumInBag) { UIInformation.GetInstance().SetInformation(TEXT(9058), TEXT(5030), UIInformationSure, UIInformationCancel); return(false); } //计算钱 钻石保底已经去掉 // int moneyMax = 0; GemData upGem = Selected_Frist_GemData.configData; int curMoney = Core.Data.playerManager.Coin; int needUnit = upGem.coin; // moneyMax = curMoney / needUnit; if (selectNum * needUnit > curMoney) { SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getString(35006)); return(false); } return(true); } else { return(false); } }
private void AddPropSprites() { foreach (PropData propData in myRD.allPropDatas) { // -- Batteries -- if (propData.GetType() == typeof(BatteryData)) { BatteryData pd = propData as BatteryData; AddSpriteRenderer("Battery", rh.s_battery, go_props, pd.pos, BatteryIconSize, 10, Color.white); } // -- Grounds -- else if (propData.GetType() == typeof(GroundData)) { GroundData pd = propData as GroundData; groundDatas.Add(pd); // also add it to my ref list! srs_grounds.Add(AddSpriteRenderer("Ground", rh.s_ground, go_props, pd.pos, pd.size, 1, Color.white)); //WHY POSITION? why not center? } // -- DispGrounds -- else if (propData.GetType() == typeof(DispGroundData)) { DispGroundData pd = propData as DispGroundData; Color color = DispGround.GetBodyColor(pd); color = new Color(color.r, color.g, color.b, color.a * 0.6f); // alpha it out a bit, to taste. AddSpriteRenderer("DispGround", rh.s_ground, go_props, pd.pos, pd.size, 1, color); } // -- Gems -- else if (propData.GetType() == typeof(GemData)) { GemData pd = propData as GemData; Sprite sprite = rh.GetGemSprite(pd.type); AddSpriteRenderer("Gem", sprite, go_props, pd.pos, GemIconSize, 10, Color.white); } // -- Snacks -- else if (propData.GetType() == typeof(SnackData)) { SnackData pd = propData as SnackData; Color color = PlayerBody.GetBodyColorNeutral(PlayerTypeHelper.TypeFromString(pd.playerType)); AddSpriteRenderer("Snack", rh.s_snack, go_props, pd.pos, SnackIconSize, 10, color); } // -- Spikes -- else if (propData.GetType() == typeof(SpikesData)) { SpikesData spikesData = propData as SpikesData; Color color = Colors.Spikes(myRD.WorldIndex);// new Color(0.7f,0.1f,0f, 0.6f); SpriteRenderer newSprite = AddSpriteRenderer("Spikes", rh.s_spikes, go_props, spikesData.pos, Vector2.one, 0, color); newSprite.drawMode = SpriteDrawMode.Tiled; newSprite.size = spikesData.size; newSprite.transform.localEulerAngles = new Vector3(0, 0, spikesData.rotation); } } }
public void InitUI() { SetShow(true); GemData data = m_data; m_txtTitle.text = m_strTitle; // Debug.Log(" idddddddddddd "+data.ID ); m_txtName.text = data.name; Debug.Log("star:" + data.star.ToString()); m_txtLevel.text = "Lv." + data.level; ShowLevelStars((int)data.star); m_gemSprite.spriteName = data.anime2D; m_gemSprite.MakePixelPerfect(); m_btnOK.TextID = 5030; }
public void InitGemInfo(int nEquipSlotIndex) { gameObject.SetActive(true); GemData gemdata = GameManager.gameManager.PlayerDataPool.GemData; for (int i = 0; i < GemSlotNum; i++) { if (i < m_GemSlot.Count) { m_GemSlot[i].InitInfo_Item(gemdata.GetGemId(nEquipSlotIndex, i), GemSlotOnClick); m_GemSlot[i].m_delSlotOnClick = GemSlotOnClick; } } m_EquipSlotIndex = nEquipSlotIndex; }
[SerializeField] private int type = 0; // 0 is action, 1 is puzzle. // ---------------------------------------------------------------- // Initialize // ---------------------------------------------------------------- public void Initialize(Room _myRoom, GemData data, int myIndex) { base.InitializeAsProp(_myRoom, data); this.myIndex = myIndex; this.type = data.type; // Load wasEverEaten! wasEverEaten = SaveStorage.GetBool(SaveKeys.DidEatGem(MyRoom, myIndex)); // Set wasEverEaten visuals. if (wasEverEaten) { sr_body.color = new Color(0.2f, 0.2f, 0.2f, 0.25f); } // Apply type visuals. sr_body.sprite = ResourcesHandler.Instance.GetGemSprite(type); }
public void ShowTargetGemInfo(GemData gem) { if (gem != null) { LabCreateGem.enabled = false; string str_des = ""; if (gem.atk > 0) { str_des = TEXT(9010) + ": " + gem.atk.ToString(); } else if (gem.def > 0) { str_des = TEXT(9011) + ": " + gem.def.ToString(); } else if (gem.skillEffect > 0) { str_des = TEXT(9009) + ": " + gem.skillEffect.ToString(); } //GemInfoDes.text = gem.name +"\n"+"[ffe265]"+str_des+"[-]"; wxl GemInfoDes.text = str_des; Spr_Gem.enabled = true; Spr_Gem.spriteName = gem.anime2D; Spr_Gem.MakePixelPerfect(); Spr_Gem.transform.localScale = new Vector3(1.2f, 1.2f, 1f); Spr_Gem.enabled = true; } else { LabCreateGem.enabled = true; string str_des = ""; str_des = TEXT(9010) + ":"; GemInfoDes.text = str_des; Spr_Gem.enabled = false; } }
/*处理宝石兑换成功 * */ public void ExchangeGem(BaseHttpRequest req, BaseResponse response) { if (response.status != BaseResponse.ERROR) { HttpRequest rq = req as HttpRequest; if (rq.Type == RequestType.GEM_EXCHANGE) { GemExChangeResponse param = response as GemExChangeResponse; GemData gd = null; ConfigData.TryGetValue(param.data.pid, out gd); Gems gm = new Gems(gd); gm.id = param.data.ppid; if (BagOfGems.ContainsKey(param.data.ppid)) { BagOfGems[param.data.ppid] = gm; } else { BagOfGems.Add(param.data.ppid, gm); } /*使用掉宝石精华 * */ Item it = Core.Data.itemManager.GetBagItem(param.data.fpid); if (it != null) { it.RtData.count -= param.data.nm; /*如果数量为0,直接从背包中删除 * */ if (it.RtData.count <= 0) { Core.Data.itemManager.RemoveBagItem(param.data.fpid); } } } } }
public static void OpenUI(GemData data, string strTitle) { if (_mInstance == null) { Object prefab = PrefabLoader.loadFromPack("JC/GetGemSucUI"); if (prefab != null) { GameObject obj = Instantiate(prefab) as GameObject; RED.AddChild(obj, DBUIController.mDBUIInstance._TopRoot); RED.TweenShowDialog(obj); _mInstance = obj.GetComponent <GetGemSucUI>(); _mInstance.m_data = data; _mInstance.m_strTitle = strTitle; } } else { RED.SetActive(true, _mInstance.gameObject); _mInstance.m_data = data; _mInstance.m_strTitle = strTitle; _mInstance.InitUI(); } }
BaseGem CreateGem( int x, int y, GemData type, Vector3 worldPosition, float delay, out float creatingDuration, GameObject prefab = null ) { BaseGem gem = Instantiate( prefab ? prefab : Resources.Load <GameObject>("Prefabs/Gems/gemPrefab"), worldPosition, Quaternion.identity, transform ).GetComponent <BaseGem>(); gem.SetPosition(new Vector2Int(x, y)); if (!prefab) { gem.SetType(type); } creatingDuration = gem.Creating(delay); return(gem); }
/// <summary> /// 更新宝石槽位 /// </summary> public void UpdateGemSlot() { int GemNum = 0; GemData gemdata = GameManager.gameManager.PlayerDataPool.GemData; for (int i = 0; i < (int)CONSTVALUE.GEM_SLOT_NUM; i++) { m_GemSlotId[i] = gemdata.GetGemId(m_CurEquipSlot, i); if (m_GemSlotId[i] >= 0) { GemNum++; } } m_EquipProGress.fillAmount = (float)GemNum / (int)CONSTVALUE.GEM_SLOT_NUM; GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack; List <GameItem> GemItemList = ItemTool.ItemFilter(BackPack, (int)ItemClass.STRENGTHEN, (int)StrengthenSubClass.GEM); for (int i = 0; i < (int)CONSTVALUE.GEM_SLOT_NUM; i++) { m_GemStrengthenButton[i].SetActive(false); if (m_GemSlotId[i] >= 0) { Tab_CommonItem line = TableManager.GetCommonItemByID(m_GemSlotId[i], 0); if (line != null) { m_GemSlotSprite[i].gameObject.SetActive(true); m_GemSlotSprite[i].spriteName = line.Icon; m_GemItemQualitySprite[i].gameObject.SetActive(true); m_GemItemQualitySprite[i].spriteName = GlobeVar.QualityColorGrid[line.Quality - 1]; m_SelectedGemName[i].text = line.Name.ToString(); m_SelectedGemLevel[i].text = GetGemLevelString(line.MinLevelRequire); m_SelectedGemAttr[i].text = Games.Item.ItemTool.GetGemAttr(m_GemSlotId[i]); } int num = 0; for (int j = 0; j < GemItemList.Count; j++) { if (m_GemSlotId[i] == GemItemList[j].DataID) { num += GemItemList[j].StackCount; } } if (num >= 2) { m_GemStrengthenButton[i].SetActive(true); } } else if (IsSlotLocked(i)) { m_GemSlotSprite[i].gameObject.SetActive(true); m_GemSlotSprite[i].spriteName = "jiesuo"; m_GemItemQualitySprite[i].gameObject.SetActive(false); m_SelectedGemName[i].text = StrDictionary.GetClientDictionaryString("#{10015}", GetSlotLockedLevel(i));; m_SelectedGemLevel[i].text = ""; m_SelectedGemAttr[i].text = ""; } else { m_GemSlotSprite[i].gameObject.SetActive(true); m_GemSlotSprite[i].spriteName = "jiahao"; m_GemItemQualitySprite[i].gameObject.SetActive(false); m_SelectedGemName[i].text = StrDictionary.GetClientDictionaryString("#{10016}"); m_SelectedGemLevel[i].text = ""; m_SelectedGemAttr[i].text = ""; } } ClearGemSlotChoose(); ClearGemItemChoose(); ClearGemSlotMark(); if (m_CurGemSlot >= 0) { ClickGemSlot(m_CurGemSlot); } }
/// <summary> /// 获取 obj /// </summary> /// <returns>The object.</returns> /// <param name="pid">Pid.</param> public void GetObject(int pid) { if (colItem != null) { ConfigDataType type = DataCore.getDataType(colItem.ID); frag_Icon.gameObject.SetActive(false); switch (type) { case ConfigDataType.Monster: MonsterData mData = Core.Data.monManager.getMonsterByNum(pid); if (mData != null) { myName = mData.name; AtlasMgr.mInstance.SetHeadSprite(spt_GiftIcon, pid.ToString()); // spt_GiftIcon.spriteName = colItem.ID.ToString (); stars.SetStar(mData.star); } break; case ConfigDataType.Item: ItemData iData = Core.Data.itemManager.getItemData(pid); if (iData != null) { myName = iData.name; spt_GiftIcon.atlas = AtlasMgr.mInstance.itemAtlas; spt_GiftIcon.spriteName = iData.iconID.ToString(); stars.SetStar(iData.star); } break; case ConfigDataType.Equip: EquipData eData = Core.Data.EquipManager.getEquipConfig(pid); if (eData != null) { myName = eData.name; spt_GiftIcon.atlas = AtlasMgr.mInstance.equipAtlas; spt_GiftIcon.spriteName = colItem.ID.ToString(); stars.SetStar(eData.star); } break; case ConfigDataType.Gems: GemData gData = Core.Data.gemsManager.getGemData(pid); if (gData != null) { myName = gData.name; spt_GiftIcon.atlas = AtlasMgr.mInstance.commonAtlas; spt_GiftIcon.spriteName = gData.anime2D; stars.SetStar(gData.star); } break; case ConfigDataType.Frag: SoulData data = Core.Data.soulManager.GetSoulConfigByNum(pid); myName = data.name; AtlasMgr.mInstance.SetHeadSprite(spt_GiftIcon, data.updateId.ToString()); stars.SetStar(Core.Data.soulManager.GetSoulConfigByNum(pid).star); if (data.type == (int)ItemType.Monster_Frage) { frag_Icon.gameObject.SetActive(true); frag_Icon.spriteName = monStr; } else if (data.type == (int)ItemType.Equip_Frage) { frag_Icon.gameObject.SetActive(true); frag_Icon.spriteName = equipStr; } break; default: RED.LogWarning("reward collection item not found : " + pid); break; } lbl_GiftName.text = myName; spt_GiftIcon.MakePixelPerfect(); //return tObj; } }
private void AddPropImages() { int snackIndex = 0; // for determining which Snacks we gots! foreach (PropData propData in myRD.allPropDatas) { // -- Spikes -- if (propData.GetType() == typeof(SpikesData)) { SpikesData spikesData = propData as SpikesData; Color color = Colors.Spikes(myRD.WorldIndex);// new Color(0.7f,0.1f,0f, 0.6f); Image newObj = AddImage("Spikes", rh.s_spikes, rt_props, spikesData.pos, spikesData.size, color); newObj.transform.localEulerAngles = new Vector3(0, 0, spikesData.rotation); newObj.type = Image.Type.Tiled; newObj.transform.localScale = Vector3.one / 100f; // kinda hacky-ish. newObj.rectTransform.sizeDelta *= 100f; newObj.transform.SetAsFirstSibling(); // put spikes BEHIND everything else. } // -- Grounds -- else if (propData.GetType() == typeof(GroundData)) { GroundData pd = propData as GroundData; Color color = new Color255(100, 130, 90).ToColor();//Ground.GetBodyColor(pd, myRD.WorldIndex); AddImage("Ground", rh.s_ground, rt_props, pd.pos, pd.size, color); } // -- DispGrounds -- else if (propData.GetType() == typeof(DispGroundData)) { DispGroundData pd = propData as DispGroundData; Color color = DispGround.GetBodyColor(pd); color = new Color(color.r, color.g, color.b, color.a * 0.6f); // alpha it out a bit, to taste. AddImage("DispGround", rh.s_ground, rt_props, pd.pos, pd.size, color); } // -- Batteries -- else if (propData.GetType() == typeof(BatteryData)) { BatteryData pd = propData as BatteryData; AddImage("Battery", rh.s_battery, rt_props, pd.pos, BatteryIconSize, Color.white); } // -- Gems -- else if (propData.GetType() == typeof(GemData)) { GemData pd = propData as GemData; Sprite sprite = rh.GetGemSprite(pd.type); AddImage("Gem", sprite, rt_props, pd.pos, GemIconSize, Color.white); } // -- Snacks -- else if (propData.GetType() == typeof(SnackData)) { SnackData pd = propData as SnackData; Color color; bool didEatSnack = SaveStorage.GetBool(SaveKeys.DidEatSnack(myRD, snackIndex)); if (didEatSnack) { color = new Color(0, 0, 0, 0.2f); } else { color = PlayerBody.GetBodyColorNeutral(PlayerTypeHelper.TypeFromString(pd.playerType)); } AddImage("Snack", rh.s_snack, rt_props, pd.pos, SnackIconSize, color); snackIndex++; } } }
public void SetType(GemData gemData) { type = gemData.type; spriteRenderer.sprite = gemData.sprite; minMatch = gemData.minMatch; }
public void SetData(EmailAward award) { if (award == null) { return; } if (!gameObject.activeSelf) { gameObject.SetActive(true); } ConfigDataType type = DataCore.getDataType(award.pid); bool anotherSacle = false; switch (type) { case ConfigDataType.Item: { ItemData data = Core.Data.itemManager.getItemData(award.pid); if (data != null) { Spr_Item.atlas = AtlasMgr.mInstance.itemAtlas; // Spr_Item.spriteName = award.pid.ToString(); Spr_Item.spriteName = data.iconID.ToString(); Lab_NameAndCount.text = data.name; } break; } case ConfigDataType.Monster: { MonsterData data = Core.Data.monManager.getMonsterByNum(award.pid); if (data != null) { AtlasMgr.mInstance.SetHeadSprite(Spr_Item, award.pid.ToString()); Lab_NameAndCount.text = data.name; anotherSacle = true; } break; } case ConfigDataType.Equip: { EquipData data = Core.Data.EquipManager.getEquipConfig(award.pid); if (data != null) { Spr_Item.atlas = AtlasMgr.mInstance.equipAtlas; Spr_Item.spriteName = data.ID.ToString(); Lab_NameAndCount.text = data.name; } break; } case ConfigDataType.Gems: { GemData data = Core.Data.gemsManager.getGemData(award.pid); if (data != null) { Spr_Item.atlas = AtlasMgr.mInstance.commonAtlas; Spr_Item.spriteName = data.anime2D; Lab_NameAndCount.text = data.name; } break; } case ConfigDataType.Frag: { SoulData data = Core.Data.soulManager.GetSoulConfigByNum(award.pid); switch ((ItemType)data.type) { case ItemType.Earth_Frage: case ItemType.Nameike_Frage: Spr_Item.atlas = AtlasMgr.mInstance.itemAtlas; Spr_Item.spriteName = data.ID.ToString(); break; case ItemType.Monster_Frage: AtlasMgr.mInstance.SetHeadSprite(Spr_Item, data.updateId.ToString()); anotherSacle = true; break; case ItemType.Equip_Frage: Spr_Item.atlas = AtlasMgr.mInstance.equipAtlas; Spr_Item.spriteName = data.updateId.ToString(); break; } Lab_NameAndCount.text = data.name; break; } } Spr_Item.MakePixelPerfect(); Spr_Item.transform.localScale = anotherSacle ? new Vector3(0.3f, 0.3f, 0) : new Vector3(0.4f, 0.4f, 0); #region 显示数量 string str_count = "x"; int temp_num = award.count / 10000; if (temp_num > 0) { str_count += (((float)(int)(((float)award.count / 10000f) * 100)) / 100f).ToString() + Core.Data.stringManager.getString(6117); } else { str_count += award.count.ToString(); } #endregion Lab_NameAndCount.text = Lab_NameAndCount.text + " [ffff00]" + str_count + "[-]"; }
public void SetData(int[] award) { if (award == null || award.Length == 0) { return; } ConfigDataType type = DataCore.getDataType(award[0]); switch (type) { case ConfigDataType.Item: { ItemData data = Core.Data.itemManager.getItemData(award[0]); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.itemAtlas; Spr_head.spriteName = award[0].ToString(); Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Monster: { MonsterData data = Core.Data.monManager.getMonsterByNum(award[0]); if (data != null) { AtlasMgr.mInstance.SetHeadSprite(Spr_head, award[0].ToString()); Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Equip: { EquipData data = Core.Data.EquipManager.getEquipConfig(award[0]); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.equipAtlas; Spr_head.spriteName = data.ID.ToString(); Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Gems: { GemData data = Core.Data.gemsManager.getGemData(award[0]); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.commonAtlas; Spr_head.spriteName = data.anime2D; Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Frag: { SoulData data = Core.Data.soulManager.GetSoulConfigByNum(award[0]); switch ((ItemType)data.type) { case ItemType.Earth_Frage: case ItemType.Nameike_Frage: Spr_head.atlas = AtlasMgr.mInstance.itemAtlas; Spr_head.spriteName = data.ID.ToString(); break; case ItemType.Monster_Frage: AtlasMgr.mInstance.SetHeadSprite(Spr_head, data.updateId.ToString()); break; } Lab_Name.text = data.name; star.SetStar(data.star); break; } } Spr_head.MakePixelPerfect(); LabNum.text = ItemNumLogic.setItemNum(award[1], LabNum, Spr_Num); //award[1].ToString(); gameObject.name = award[0].ToString(); isEnable = System.Convert.ToBoolean(award[2]); }
public void SetData(ItemOfReward award) { m_data = award; ConfigDataType type = DataCore.getDataType(award.pid); RED.SetActive(false, sp_soul.gameObject); switch (type) { case ConfigDataType.Item: { ItemData data = Core.Data.itemManager.getItemData(award.pid); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.itemAtlas; // Spr_head.spriteName = award.pid.ToString(); Spr_head.spriteName = data.iconID.ToString(); Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Monster: { MonsterData data = Core.Data.monManager.getMonsterByNum(award.pid); if (data != null) { AtlasMgr.mInstance.SetHeadSprite(Spr_head, award.pid.ToString()); Lab_Name.text = data.name; star.SetStar(data.star); if (sp_soul != null) { Monster mon = award.toMonster(Core.Data.monManager); int attr = (int)(mon.RTData.Attribute); sp_soul.spriteName = "Attribute_" + attr.ToString(); RED.SetActive(true, sp_soul.gameObject); } } break; } case ConfigDataType.Equip: { EquipData data = Core.Data.EquipManager.getEquipConfig(award.pid); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.equipAtlas; Spr_head.spriteName = data.ID.ToString(); Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Gems: { GemData data = Core.Data.gemsManager.getGemData(award.pid); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.commonAtlas; Spr_head.spriteName = data.anime2D; Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Frag: { SoulData data = Core.Data.soulManager.GetSoulConfigByNum(award.pid); switch ((ItemType)data.type) { case ItemType.Earth_Frage: case ItemType.Nameike_Frage: Spr_head.atlas = AtlasMgr.mInstance.itemAtlas; Spr_head.spriteName = data.ID.ToString(); break; case ItemType.Monster_Frage: AtlasMgr.mInstance.SetHeadSprite(Spr_head, data.updateId.ToString()); sp_soul.spriteName = "bag-0003"; sp_soul.MakePixelPerfect(); RED.SetActive(true, sp_soul.gameObject); break; case ItemType.Equip_Frage: Spr_head.atlas = AtlasMgr.mInstance.equipAtlas; Spr_head.spriteName = data.updateId.ToString(); Spr_head.MakePixelPerfect(); sp_soul.spriteName = "sui"; sp_soul.MakePixelPerfect(); RED.SetActive(true, sp_soul.gameObject); break; } Lab_Name.text = data.name; star.SetStar(data.star); break; } } Spr_head.MakePixelPerfect(); }
public void SetData(EmailAward award) { if (award == null) { if (!NullObject.activeSelf) { NullObject.SetActive(true); } if (ContentObject.activeSelf) { ContentObject.SetActive(false); } return; } if (NullObject.activeSelf) { NullObject.SetActive(false); } if (!ContentObject.activeSelf) { ContentObject.SetActive(true); } ConfigDataType type = DataCore.getDataType(award.pid); switch (type) { case ConfigDataType.Item: { ItemData data = Core.Data.itemManager.getItemData(award.pid); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.itemAtlas; // Spr_head.spriteName = award.pid.ToString(); Spr_head.spriteName = data.iconID.ToString(); Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Monster: { MonsterData data = Core.Data.monManager.getMonsterByNum(award.pid); if (data != null) { AtlasMgr.mInstance.SetHeadSprite(Spr_head, award.pid.ToString()); Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Equip: { EquipData data = Core.Data.EquipManager.getEquipConfig(award.pid); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.equipAtlas; Spr_head.spriteName = data.ID.ToString(); Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Gems: { GemData data = Core.Data.gemsManager.getGemData(award.pid); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.commonAtlas; Spr_head.spriteName = data.anime2D; Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Frag: { SoulData data = Core.Data.soulManager.GetSoulConfigByNum(award.pid); switch ((ItemType)data.type) { case ItemType.Earth_Frage: case ItemType.Nameike_Frage: Spr_head.atlas = AtlasMgr.mInstance.itemAtlas; Spr_head.spriteName = data.ID.ToString(); break; case ItemType.Monster_Frage: AtlasMgr.mInstance.SetHeadSprite(Spr_head, data.updateId.ToString()); break; } Lab_Name.text = data.name; star.SetStar(data.star); break; } } Spr_head.MakePixelPerfect(); #region 显示数量 int temp_num = award.count / 10000; if (temp_num > 0) { LabNum.text = (((float)(int)(((float)award.count / 10000f) * 100)) / 100f).ToString() + Core.Data.stringManager.getString(6117); } else { LabNum.text = award.count.ToString(); } #endregion }
public void Awake(GemData data, GemType type) { gemData = data; this.m_GemType = type; }