private int flagChange; //是不是可以点按钮 只有自己的可以点 /* methods */ /// <summary> /// 初始化 /// </summary> public void init(int currentStarBroeIndex, Card card, WindowBase win, int flag) { currentcard = card; fatherWindow = win; flagChange = flag; this.currentStarBroeIndex = currentStarBroeIndex; //得到指定位置的星魂(包括位置) StarSoulBore starSoulBore = currentcard.getStarSoulBoreByIndex(currentStarBroeIndex); if (starSoulBore != null) { if (starSoulBore.getSid() != 0) { starSoul = new StarSoul("0", starSoulBore.getSid(), starSoulBore.getExp(), 1); } else { starSoul = StorageManagerment.Instance.getStarSoul(starSoulBore.getUid());// 自己的 } } else { starSoul = null; } this.onClickEvent = grooveButtonClickHander; UpdateUI(); }
public override void DoClickEvent() { base.DoClickEvent(); if (goods.getGoodsType() == GoodsType.CARD) { UiManager.Instance.openWindow <CardBookWindow> ((win) => { Card card = CardManagerment.Instance.createCard(goods.getGoodsSid()); win.init(card, CardBookWindow.OTHER, null); }); } else if (goods.getGoodsType() == GoodsType.EQUIP) { UiManager.Instance.openWindow <EquipAttrWindow> ((win) => { Equip eq = EquipManagerment.Instance.createEquip("", goods.getGoodsSid(), 0, 0, 0); win.Initialize(eq, EquipAttrWindow.OTHER, null); }); } else if (goods.getGoodsType() == GoodsType.TOOL) { Prop prop = PropManagerment.Instance.createProp(goods.getGoodsSid(), goods.getGoodsShowNum()); UiManager.Instance.openDialogWindow <PropAttrWindow> ((win) => { win.Initialize(prop); }); } else if (goods.getGoodsType() == GoodsType.STARSOUL) { StarSoul starSoul = StarSoulManager.Instance.createStarSoul(goods.getGoodsSid()); UiManager.Instance.openDialogWindow <StarSoulAttrWindow> ((win) => { win.Initialize(starSoul, StarSoulAttrWindow.AttrWindowType.None); }); } }
/// <summary> /// init /// </summary> /// <param name="starSoul">星魂--修改星魂数据前请保证不是仓库中的星魂</param> /// <param name="iconType">底本文本类型(-1=不显示,0=显示星魂名,1=星魂名+等级,2=星魂数量)</param> public void init(StarSoul starSoul, int iconType) { initClear(); this.starSoul = starSoul; this.iconType = iconType; UpdateInfo(); }
public void init(PrizeSample prize, int state, int dayNum, int sid, int type) { this.count = StringKit.toInt(prize.num); this.signState = state; this.prize = prize; this.dayOfMonth = dayNum; this.sid = sid; this.type = type; if (prize.type == PrizeType.PRIZE_CARD) { card = CardManagerment.Instance.createCard(prize.pSid); } else if (prize.type == PrizeType.PRIZE_EQUIPMENT) { equip = EquipManagerment.Instance.createEquip(prize.pSid); } else if (prize.type == PrizeType.PRIZE_MAGIC_WEAPON) { magicWeapon = MagicWeaponManagerment.Instance.createMagicWeapon(prize.pSid); } else if (prize.type == PrizeType.PRIZE_PROP) { prop = PropManagerment.Instance.createProp(prize.pSid); } else if (prize.type == PrizeType.PRIZE_STARSOUL) { starSoul = StarSoulManager.Instance.createStarSoul(prize.pSid); } UpdateInfo(); }
/// <summary> /// 创建星魂对象 /// </summary> /// <param name="array">元组数据结构</param> public StarSoul createStarSoul(ErlArray array) { StarSoul starSoul = new StarSoul(); starSoul.bytesRead(0, array); return(starSoul); }
/// <summary> /// 添加星魂到猎魂仓库 /// </summary> /// <param name="data">数据</param> public void addHuntStarSoulStorage(ErlArray data) { StarSoul starSoul = StarSoulManager.Instance.createStarSoul(); starSoul.bytesRead(0, data); addHuntStarSoulStorage(starSoul, true); }
/// <summary> /// 强化星魂通讯读取处理 /// </summary> /// <param name="message">Message.</param> private void doStrengStarSoul(ErlKVMessage message) { ErlType erlType = message.getValue("value") as ErlType; if (erlType is ErlArray) { ErlArray arr = erlType as ErlArray; int index = 0; string uid = arr.Value [index++].getValueString(); long exp = StringKit.toLong(arr.Value [index++].getValueString()); StorageManagerment smanager = StorageManagerment.Instance; StarSoulManager manager = StarSoulManager.Instance; StarSoul starSoul = smanager.getStarSoul(uid); if (starSoul != null) { manager.delStarSoulExp(exp); starSoul.updateExp(starSoul.getEXP() + exp); starSoul.isNew = false; } StorageManagerment.Instance.starSoulStorageVersion++; if (callback != null) { callback(); callback = null; } } else { UiManager.Instance.openDialogWindow <MessageWindow> ((win) => { win.initWindow(1, LanguageConfigManager.Instance.getLanguage("s0093"), null, erlType.getValueString(), null); }); } }
/// <summary> /// 获取星魂槽上所有的星魂 /// </summary> public StarSoul[] getStarSoulByAll() { if (bores == null || bores.Count == 0) { return(null); } List <StarSoul> temList = new List <StarSoul>(); StarSoul starSoul; StorageManagerment manager = StorageManagerment.Instance; StarSoulBore starSoulBore; for (int i = 0; i < bores.Count; i++) { starSoulBore = (StarSoulBore)bores[i]; if (starSoulBore.getSid() != 0) { starSoul = new StarSoul("0", starSoulBore.getSid(), starSoulBore.getExp(), 0); } else { starSoul = manager.getStarSoul(starSoulBore.getUid()); } if (starSoul == null) { continue; } temList.Add(starSoul); } return(temList.ToArray()); }
public override void DoClickEvent() { base.DoClickEvent(); if (goods.getGoodsType() == GoodsType.CARD) { UiManager.Instance.openWindow <CardBookWindow> ((win) => { Card card = CardManagerment.Instance.createCard(goods.getGoodsSid()); win.init(card, CardBookWindow.OTHER, null); }); } else if (goods.getGoodsType() == GoodsType.EQUIP) { UiManager.Instance.openWindow <EquipAttrWindow> ((win) => { Equip eq = EquipManagerment.Instance.createEquip("", goods.getGoodsSid(), 0, 0, 0); win.Initialize(eq, EquipAttrWindow.OTHER, null); }); } else if (goods.getGoodsType() == GoodsType.TOOL) { Prop prop = PropManagerment.Instance.createProp(goods.getGoodsSid(), goods.getGoodsShowNum()); UiManager.Instance.openDialogWindow <PropBuyWindow> ((win) => { win.Initialize(prop, goods, () => { MysticalShopBuyFPort fport = FPortManager.Instance.getFPort("MysticalShopBuyFPort") as MysticalShopBuyFPort; fport.buyGoods(goods.sid, goods.showIndex + 1, buyCallBack); }); }); } else if (goods.getGoodsType() == GoodsType.STARSOUL) { StarSoul starSoul = StarSoulManager.Instance.createStarSoul(goods.getGoodsSid()); UiManager.Instance.openDialogWindow <StarSoulAttrWindow> ((win) => { win.Initialize(starSoul, StarSoulAttrWindow.AttrWindowType.None); }); } }
//设置创建按钮信息 private void setCreatButton(PrizeSample _prize) { if (_prize == null) { return; } else { prize = _prize; icon.gameObject.SetActive(false); back.spriteName = QualityManagerment.qualityIDToIconSpriteName(_prize.getQuality()); count = StringKit.toInt(prize.num); if (prize.type == PrizeType.PRIZE_CARD) { card = CardManagerment.Instance.createCard(prize.pSid); } else if (prize.type == PrizeType.PRIZE_EQUIPMENT) { equip = EquipManagerment.Instance.createEquip(prize.pSid); } else if (prize.type == PrizeType.PRIZE_MAGIC_WEAPON) { magicWeapon = MagicWeaponManagerment.Instance.createMagicWeapon(prize.pSid); } else if (prize.type == PrizeType.PRIZE_PROP) { prop = PropManagerment.Instance.createProp(prize.pSid); } else if (prize.type == PrizeType.PRIZE_STARSOUL) { starSoul = StarSoulManager.Instance.createStarSoul(prize.pSid); } updateInfo(); } }
private void UpdateStarSoulView(StarSoul starsoulView) { if (customIconPoint == null) { return; } back.spriteName = "iconback_3"; icon.gameObject.SetActive(false); customIconPoint.SetActive(true); if (customIconPoint.transform.childCount > 0) { Utils.RemoveAllChild(customIconPoint.transform); } ResourcesManager.Instance.LoadAssetBundleTexture(ResourcesManager.STARSOUL_ICONPREFAB_PATH + starsoulView.getIconId(), customIconPoint.transform, (obj) => { GameObject gameObj = obj as GameObject; if (gameObj != null) { Transform childTrans = gameObj.transform; if (childTrans != null) { StarSoulEffectCtrl effectCtrl = childTrans.gameObject.GetComponent <StarSoulEffectCtrl>(); effectCtrl.setColor(starsoulView.getQualityId()); } } }); num.text = "x" + count; }
public void setSoulStarState(string cardUid, int hole, string starsoulUid) { StorageManagerment smanager = StorageManagerment.Instance; Card card = smanager.getRole(cardUid); if (card != null) { // 设置被替换的星魂状态为未装备(如果是直接穿装备则不执行) StarSoulBore oldStarSoulBore = card.getStarSoulBoreByIndex(hole); if (oldStarSoulBore != null) { StarSoul oldStarSoul = smanager.getStarSoul(oldStarSoulBore.getUid()); if (oldStarSoul != null) { oldStarSoul.unState(EquipStateType.OCCUPY); oldStarSoul.isNew = false; } } // 设置被穿的星魂状态为装备 StarSoul starSoul = smanager.getStarSoul(starsoulUid); if (starSoul != null) { starSoul.setState(EquipStateType.OCCUPY); starSoul.isNew = false; } card.addStarSoulBore(starsoulUid, hole); activeCard = card; } StorageManagerment.Instance.starSoulStorageVersion++; }
/// <summary> /// 开始更新星魂仓库的每一条数据 /// </summary> /// <param name="item">Item.</param> /// <param name="index">Index.</param> public override void updateItem(GameObject item, int index) { ButtonStoreStarSoul button = item.GetComponent <ButtonStoreStarSoul> (); StarSoul startsol = starSouls[index] as StarSoul; button.UpdateSoul(startsol, intoType, isAutoSelect); }
/// <summary> /// 移除卡片星魂槽的星魂 /// <param name="index">星魂槽位置</param> /// </summary> public bool delStarSoulBoreByIndex(int index) { if (bores == null) { return(false); } StorageManagerment smanager = StorageManagerment.Instance; StarSoulBore starSoulBore; for (int i = 0; i < bores.Count; i++) { starSoulBore = (StarSoulBore)bores[i]; if (starSoulBore.checkStarSoulBoreByIndex(index)) { StarSoul starSoul = smanager.getStarSoul(starSoulBore.getUid()); if (starSoul != null) { starSoul.unState(EquipStateType.OCCUPY); starSoul.isNew = false; } bores.RemoveAt(i); return(true); } } return(false); }
/// <summary> /// 初始化星魂强化界面 /// </summary> public void init(Card card, StarSoul starSoul, ButtonStoreStarSoul.ButtonStateType type) { this.card = card; this.type = type; this.starSoul = starSoul; initContent(card, starSoul, type); }
/// <summary> /// Initialize /// </summary> /// <param name="starSoul">星魂</param> /// <param name="showType">显示类型</param> /// <param name="card">激活的卡片</param> public void Initialize(StarSoul starSoul, AttrWindowType showType, Card card, int starBroeIndex, int flaggg) { this.showType = showType; this.starSoul = starSoul; this.currentCard = card; this.starBroeIndex = starBroeIndex; InitializeUI(flaggg); }
/* methods */ /// <summary> /// 更新星魂仓库列表. /// </summary> public void UpdateSoul(StarSoul starSoul, ButtonStateType type, bool isAutoSelect) { this.stateType = type; this.starSoul = starSoul; isSelect = isAutoSelect; storeButton.setFatherWindow(fatherWindow); UpdateIU(); }
private void initItem() { equip = null; prop = null; prize = null; card = null; magicWeapon = null; starSoul = null; }
/// <summary> /// 更新星魂仓库中的星魂数据 /// </summary> /// <param name="uid">uid</param> /// <param name="ea">数据</param> public void updateStarSoulStorage(string uid, ErlArray ea) { StarSoul starSoul = starSoulStorage.getPropByUid(uid) as StarSoul; if (starSoul != null) { starSoul.bytesRead(0, ea); } }
/// <summary> /// 得到飘字 /// </summary> /// <returns>The star soul dese.</returns> /// <param name="starSoul">Star soul.</param> public string getStarSoulDese(StarSoul starSoul) { if (starSoul != null) { StarSoulSample starSoulSamle = starSoul.getStarSoulSample(); AttrChangeSample[] attrChangeSample = starSoulSamle.getAttrChangeSample(); return(DescribeManagerment.getDescribe(starSoulSamle.desc, starSoul.getLevel(), attrChangeSample)); } return(null); }
private void addStorageProp(string type, ErlArray data) { if (type == StorageFPort.GOODS) { PropStorageVersion++; Prop prop = PropManagerment.Instance.createProp(); prop.bytesRead(0, data); addGoodsProp(prop); } else if (type == StorageFPort.CARD) { RoleStorageVersion++; Card card = CardManagerment.Instance.createCard(); card.bytesRead(0, data); addCardProp(card); IncreaseManagerment.Instance.clearData(IncreaseManagerment.TYPE_CARD); } else if (type == StorageFPort.BEAST) { beastStorageVersion++; Card card = CardManagerment.Instance.createCard(); card.bytesRead(0, data); addBeastProp(card); IncreaseManagerment.Instance.clearData(IncreaseManagerment.TYPE_BEAST); } else if (type == StorageFPort.EQUIPMENT || type == StorageFPort.EQUIPMENT1) { EquipStorageVersion++; Equip equip = EquipManagerment.Instance.createEquip(); equip.bytesRead(0, data); equip.isNew = true; addEquipProp(equip); } else if (type == StorageFPort.STAR_SOUL_STORAGE) { starSoulStorageVersion++; StarSoul starSoul = StarSoulManager.Instance.createStarSoul(data); addStarSoulStorage(starSoul, true); } else if (type == StorageFPort.MOUNTS) { mountsStorageVersion++; Mounts mounts = MountsManagerment.Instance.createMounts(data); addMounts(mounts); } else if (type == StorageFPort.MAGIC_WEAPON) { magicWeaponVersion++; MagicWeapon magic = new MagicWeapon(); magic.bytesRead(0, data); addMagicWeaponProp(magic); } }
//创建星魂奖励 private GameObject CreateStarSoulGoodsItem(int sid, int num) { GameObject obj = Instantiate(goodsViewPrefab) as GameObject; obj.transform.localScale = new Vector3(0.7f, 0.7f, 1); GoodsView view = obj.transform.GetComponent <GoodsView> (); StarSoul starSoul = StarSoulManager.Instance.createStarSoul(sid); view.init(starSoul); view.fatherWindow = this; return(obj); }
/***/ public override void DoClickEvent() { base.DoClickEvent(); if (stateType == ButtonStoreStarSoul.ButtonStateType.Power) // 强化 { UiManager.Instance.openWindow <StarSoulStoreStrengWindow>((win) => { win.init(starSoul); }); } else if (stateType == ButtonStoreStarSoul.ButtonStateType.Replace) // 替换 { StarSoulManager manager = StarSoulManager.Instance; Card activeCard = manager.getActiveCard(); int activeBoreIndex = manager.getActiveBoreIndex(); tempStarSoul = manager.getActiveStarSoulDese(); if (activeCard == null || activeBoreIndex == -1) { MaskWindow.UnlockUI(); return; } StarSoulBore starBore = activeCard.getStarSoulBoreByIndex(activeBoreIndex); StarSoul ss = null; if (starBore != null) { ss = StorageManagerment.Instance.getStarSoul(starBore.getUid()); } StarSoulManager.Instance.setState(1); StarSoulManager.Instance.setActiveSoulStarInfo(activeCard.uid, starSoul.uid, activeBoreIndex); // 与服务器通讯 (FPortManager.Instance.getFPort("StarSoulEquipFPort") as StarSoulEquipFPort).putOnEquipStarSoulAccess(activeCard.uid, starSoul.uid, activeBoreIndex, () => { putOnFinished(); }); } else if (stateType == ButtonStoreStarSoul.ButtonStateType.PutOn) // 穿戴 { StarSoulManager manager = StarSoulManager.Instance; Card activeCard = manager.getActiveCard(); int activeBoreIndex = manager.getActiveBoreIndex(); tempStarSoul = manager.getActiveStarSoulDese(); if (activeCard == null || activeBoreIndex == -1) { MaskWindow.UnlockUI(); return; } StarSoulManager.Instance.setState(2); StarSoulManager.Instance.setActiveSoulStarInfo(activeCard.uid, starSoul.uid, activeBoreIndex); // 与服务器通讯 (FPortManager.Instance.getFPort("StarSoulEquipFPort") as StarSoulEquipFPort).putOnEquipStarSoulAccess(activeCard.uid, starSoul.uid, activeBoreIndex, () => { putOnFinished(); }); } }
/// <summary> /// 检查可以换指定的星魂不 /// </summary> public bool checkPuton(Card card, StarSoul ss) { if (!starSoul.checkStarSoulCanbePut(card, ss)) { UiManager.Instance.openDialogWindow <MessageLineWindow> ((win) => { win.Initialize(LanguageConfigManager.Instance.getLanguage ("StarSoulStrengWindow_DecforUnPutOnn"), false); }); return(false); } return(true); }
/// <summary> /// 创建星魂条目 /// </summary> /// <param name="starSoul">星魂</param> private GameObject CreateStarSoulItem(StarSoul starSoul) { Transform trans = awardContent.transform.FindChild(starSoul.uid); if (trans != null) // 避免出现相同uid的星魂 { GameObject.Destroy(trans.gameObject); } GameObject obj = NGUITools.AddChild(awardContent, goodsViewProfab) as GameObject; obj.transform.localScale = new Vector3(0.85f, 0.85f, 1); GoodsView view = obj.transform.GetComponent <GoodsView> (); view.LockOnClick = false; view.init(starSoul, GoodsView.BOTTOM_TEXT_NAME); view.fatherWindow = tapContent.fatherwindow; view.onClickCallback = () => { StorageManagerment smanager = StorageManagerment.Instance; if (starSoul.getStarSoulType() == 0) // 经验类星魂 { bool isQuality = starSoul.getQualityId() >= QualityType.EPIC?true:false; if (isQuality) { UiManager.Instance.openDialogWindow <MessageWindow> ((win) => { win.msg.msgInfo = starSoul.uid; win.initWindow(2, LanguageConfigManager.Instance.getLanguage("s0094"), LanguageConfigManager.Instance.getLanguage("s0093"), LanguageConfigManager.Instance.getLanguage("StarSoulWindow_storeContent_changeQuality"), doOnClickCallback); }); return; } } else // 非经验类星魂 { if (smanager.isStarSoulStorageFull(1)) // 星魂仓库满 { UiManager.Instance.openDialogWindow <MessageLineWindow>((win) => { win.Initialize(LanguageConfigManager.Instance.getLanguage("StarSoulWindow_StarSoul_Storage_Full")); }); return; } } MessageHandle msg = new MessageHandle(); msg.buttonID = MessageHandle.BUTTON_RIGHT; msg.msgInfo = starSoul.uid; doOnClickCallback(msg); }; view.longPassCallback = () => { UiManager.Instance.openDialogWindow <StarSoulAttrWindow> ( (win) => { win.Initialize(starSoul, StarSoulAttrWindow.AttrWindowType.None); }); }; return(obj); }
/// <summary> /// 检查星魂能否装配. /// </summary> public bool checkStarSoulCanbePut(Card card, StarSoul resStarSoul) { StarSoulManager manager = StarSoulManager.Instance; int[] arr = manager.getCardSoulExistType(card, resStarSoul); for (int i = 0; i < arr.Length; i++) { if (this.getStarSoulType() == arr[i]) { return(false); } } return(true); }
/** 初始化新经验条 */ private LevelupInfo createLevelupInfo(StarSoul oldStarSoul, StarSoul newStarSoul) { LevelupInfo levelupInfo = new LevelupInfo(); levelupInfo.newExp = newStarSoul.getEXP(); levelupInfo.newExpDown = EXPSampleManager.Instance.getEXPDown(newStarSoul.getEXPSid(), newStarSoul.getLevel()); levelupInfo.newExpUp = EXPSampleManager.Instance.getEXPUp(newStarSoul.getEXPSid(), newStarSoul.getLevel()); levelupInfo.newLevel = newStarSoul.getLevel(); levelupInfo.oldExp = oldStarSoul.getEXP(); levelupInfo.oldExpDown = EXPSampleManager.Instance.getEXPDown(oldStarSoul.getEXPSid(), oldStarSoul.getLevel()); levelupInfo.oldExpUp = EXPSampleManager.Instance.getEXPUp(oldStarSoul.getEXPSid(), oldStarSoul.getLevel()); levelupInfo.oldLevel = oldStarSoul.getLevel(); return(levelupInfo); }
public void starSoulIndefity() { StorageManagerment smanager = StorageManagerment.Instance; StarSoulManager manager = StarSoulManager.Instance; StarSoul starSoul = smanager.getStarSoul(indetify_uid); if (starSoul != null) { manager.delStarSoulExp(exp); starSoul.updateExp(starSoul.getEXP()); starSoul.isNew = false; } StorageManagerment.Instance.starSoulStorageVersion++; init(starSoul); }
/// <summary> /// 得到活动的星魂的描述 /// </summary> /// <returns>The active star soul dese.</returns> public string getActiveStarSoulDese() { Card card = getActiveCard(); int index = getActiveBoreIndex(); StarSoulBore starBore = card.getStarSoulBoreByIndex(index); if (starBore != null) { StarSoul ss = StorageManagerment.Instance.getStarSoul(starBore.getUid()); if (ss != null) { return(getStarSoulDese(ss)); } } return(null); }
// Use this for initialization public void Initialize(PropMessageLineWindow father, int y, PrizeSample prize) { targetY = y; fatherWindow = father; this.prize = prize; iconBg.gameObject.SetActive(false); icon.mainTexture = null; if (prize == null) { return; } if (prize.type == PrizeType.PRIZE_STARSOUL) { iconBg.gameObject.SetActive(true); iconBg.spriteName = "iconback_3"; StarSoul starsoulView = StarSoulManager.Instance.createStarSoul(prize.pSid); msgText.text = starsoulView.getName(); ResourcesManager.Instance.LoadAssetBundleTexture(ResourcesManager.STARSOUL_ICONPREFAB_PATH + starsoulView.getIconId(), icon.transform, (obj) => { GameObject gameObj = obj as GameObject; if (gameObj != null) { Transform childTrans = gameObj.transform; if (childTrans != null) { StarSoulEffectCtrl effectCtrl = childTrans.gameObject.GetComponent <StarSoulEffectCtrl>(); effectCtrl.setColor(starsoulView.getQualityId()); } } }); } else if (prize.type == -1) { iconBg.gameObject.SetActive(false); msgText.text = prize.prizeDec; return; } else { iconBg.gameObject.SetActive(true); iconBg.spriteName = QualityManagerment.qualityIDToIconSpriteName(prize.getQuality()); ResourcesManager.Instance.LoadAssetBundleTexture(prize.getIconPath(), icon); msgText.text = prize.getPrizeName(); } //msgText.text =QualityManagerment.getQualityColor( prize.getQuality ()) +prize.getPrizeName (); msgText.text += " x " + prize.getPrizeNumByInt(); }