/** 执行经验转化 */ private void DoExchangeExp() { StarSoulManager manager = StarSoulManager.Instance; string str = StarSoulManager.Instance.getExchangeExpStateString(); if (string.IsNullOrEmpty(str)) { MaskWindow.UnlockUI(); return; } bool isState = manager.isStarSoulStateByChangeDic(EquipStateType.LOCKED); if (isState) { UiManager.Instance.openDialogWindow <MessageWindow> ((win) => { win.initWindow(1, LanguageConfigManager.Instance.getLanguage("s0094"), null, LanguageConfigManager.Instance.getLanguage("StarSoulWindow_storeContent_changeState"), null); }); return; } bool isQuality = manager.isStarSoulQualityByChangeDic(QualityType.EPIC); if (isQuality) { UiManager.Instance.openDialogWindow <MessageWindow> ((win) => { win.initWindow(2, LanguageConfigManager.Instance.getLanguage("s0094"), LanguageConfigManager.Instance.getLanguage("s0093"), LanguageConfigManager.Instance.getLanguage("StarSoulWindow_storeContent_changeQuality"), doExchangeQualityBack); }); return; } MessageHandle msg = new MessageHandle(); msg.buttonID = MessageHandle.BUTTON_RIGHT; // 与服务器通讯 doExchangeQualityBack(msg); }
/// <summary> /// 凹槽按钮的点击事件 /// </summary> private void grooveButtonClickHander(GameObject obj) { if (starSoul != null) { UiManager.Instance.openDialogWindow <StarSoulAttrWindow>((win) => { if (flagChange != CardBookWindow.CLICKCHATSHOW) { win.Initialize(starSoul, StarSoulAttrWindow.AttrWindowType.Power_Replace_Unsnatch, currentcard, currentStarBroeIndex, flagChange); } else { win.Initialize(starSoul, StarSoulAttrWindow.AttrWindowType.None, currentcard, currentStarBroeIndex, flagChange); } }); } else if (starSoul == null && flagChange != CardBookWindow.CLICKCHATSHOW) //没有星魂用于装配 { UiManager.Instance.openWindow <StarSoulStoreAloneWindow>((win) => { StarSoulManager manager = StarSoulManager.Instance; manager.setActiveInfo(currentcard, currentStarBroeIndex); win.init(currentcard, starSoul, ButtonStoreStarSoul.ButtonStateType.PutOn); }); } else { MaskWindow.UnlockUI(); } }
/// <summary> /// 普通裂魂 /// </summary> private void huntStarSoul(int index, ErlArray arr) { StarSoulManager manager = StarSoulManager.Instance; StorageManagerment smanager = StorageManagerment.Instance; ArrayList starSouls = new ArrayList(); // 猎魂库sid int huntLibSid = StringKit.toInt(arr.Value [index++].getValueString()); manager.setHuntQuality(huntLibSid); ErlArray starSoulArr = arr.Value [index++] as ErlArray; if (starSoulArr != null && starSoulArr.Value.Length > 0) { StarSoul starSoul; for (int i = 0; i < starSoulArr.Value.Length; i++) { starSoul = manager.createStarSoul(starSoulArr.Value[i] as ErlArray); smanager.addHuntStarSoulStorage(starSoul, true); starSoul.isNew = false; starSouls.Add(starSoul); } StorageManagerment.Instance.huntStarSoulStorageVersion++; } int num = StringKit.toInt(arr.Value[index++].getValueString()); manager.setDebrisNumber(manager.getDebrisNumber() + num); if (callback != null) { callback(starSouls, num, huntLibSid); callback = null; } }
/// <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> private void HuntStarSoulByRmb(int index, ErlArray arr) { StarSoulManager manager = StarSoulManager.Instance; StorageManagerment smanager = StorageManagerment.Instance; ArrayList starSouls = new ArrayList(); int debrisNumber = StringKit.toInt(arr.Value [index++].getValueString()); if (debrisNumber > 0) { manager.addDebrisNumber(debrisNumber); } ErlArray starSoulArr = arr.Value [index++] as ErlArray; if (starSoulArr != null && starSoulArr.Value.Length > 0) { StarSoul starSoul; for (int i = 0; i < starSoulArr.Value.Length; i++) { starSoul = manager.createStarSoul(starSoulArr.Value[i] as ErlArray); smanager.addHuntStarSoulStorage(starSoul, true); starSoul.isNew = false; starSouls.Add(starSoul); } StorageManagerment.Instance.huntStarSoulStorageVersion++; } if (callback != null) { callback(starSouls, debrisNumber, 0); callback = null; } }
/***/ 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> /// <param name="message">Message.</param> private void doPutonStarSoul(ErlKVMessage message) { ErlType erlType = message.getValue("value") as ErlType; StarSoulManager manager = StarSoulManager.Instance; manager.clearActiveCard(); if (erlType is ErlArray) { ErlArray arr = erlType as ErlArray; int index = 0; // 卡片 string cardUid = arr.Value [index++].getValueString(); // 星魂槽位 int hole = StringKit.toInt(arr.Value [index++].getValueString()); // 星魂uid string starsoulUid = arr.Value [index++].getValueString(); StarSoulManager.Instance.setSoulStarState(cardUid, hole, 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); // } // 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); }); } }
/** 更新button */ public void UpdateButton() { if (stateType == ButtonStateType.Lock) { storeButton.gameObject.SetActive(false); storeChoose.gameObject.SetActive(true); StarSoulManager manager = StarSoulManager.Instance; bool isExist = manager.checkLockState(starSoul.uid); if (isExist) { storeChoose.value = manager.getLockState(starSoul.uid); } else { storeChoose.value = starSoul.checkState(EquipStateType.LOCKED); } } else if (stateType == ButtonStateType.CHANGE) { if (starSoul.checkState(EquipStateType.OCCUPY) || starSoul.checkState(EquipStateType.LOCKED)) // 装备中或者锁定中转化经验不显示勾选框 { storeButton.gameObject.SetActive(false); storeChoose.gameObject.SetActive(false); storeChoose.value = false; } else { StarSoulManager manager = StarSoulManager.Instance; storeButton.gameObject.SetActive(false); storeChoose.gameObject.SetActive(true); if (isSelect) { if (starSoul.getQualityId() <= GameManager.Instance.starSoulOneKeySelectValue) { StarSoulManager.Instance.setChangeExpState(starSoul.uid, true); } } if (starSoul.getStarSoulType() == 0) { StarSoulManager.Instance.setChangeExpState(starSoul.uid, true); } storeChoose.value = manager.getChangeExpState(starSoul.uid); } } else { storeButton.gameObject.SetActive(true); storeChoose.gameObject.SetActive(false); storeButton.UpdateSoul(starSoul, stateType); } }
/// <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); }
public override void buttonEventBase(GameObject gameObj) { base.buttonEventBase(gameObj); if (gameObj.name == "close") { this.dialogCloseUnlockUI = true; finishWindow(); } else if (gameObj.name == "buttonPower") { finishWindow(); EventDelegate.Add(OnHide, () => { UiManager.Instance.openWindow <StarSoulStoreStrengWindow>((win) => { win.init(starSoul); }); }); } else if (gameObj.name == "buttonUnsnatch") { if (currentCard == null || starBroeIndex == -1) { MaskWindow.UnlockUI(); return; } finishWindow(); EventDelegate.Add(OnHide, () => { StarSoulManager.Instance.setInfo(currentCard.uid, starBroeIndex); StarSoulManager.Instance.soul = starSoul; (FPortManager.Instance.getFPort("StarSoulEquipFPort") as StarSoulEquipFPort).putOffEquipStarSoulAccess(currentCard.uid, starBroeIndex, () => { putOffFinished(); }); }); } else if (gameObj.name == "buttonReplace") { if (currentCard == null || starBroeIndex == -1) { MaskWindow.UnlockUI(); return; } StarSoulManager manager = StarSoulManager.Instance; manager.setActiveInfo(currentCard, starBroeIndex); finishWindow(); EventDelegate.Add(OnHide, () => { UiManager.Instance.openWindow <StarSoulStoreAloneWindow>((win) => { win.init(currentCard, starSoul, ButtonStoreStarSoul.ButtonStateType.Replace); }); }); } }
/// <summary> /// 回调读取通讯 /// </summary> /// <param name="message">Message.</param> public override void read(ErlKVMessage message) { string msgInfo = (message.getValue("msg") as ErlType).getValueString(); if (msgInfo == "info") { ErlType erlType = message.getValue("value") as ErlType; if (erlType is ErlArray) { StarSoulManager manager = StarSoulManager.Instance; ErlArray arr = erlType as ErlArray; StarSoulInfo starSoulInfo = manager.createStarSoulInfo(arr); manager.setStarSoulInfo(starSoulInfo); } else { UiManager.Instance.openDialogWindow <MessageWindow> ((win) => { win.initWindow(1, LanguageConfigManager.Instance.getLanguage("s0093"), null, erlType.getValueString(), null); }); } if (callback != null) { callback(); callback = null; } } else if (msgInfo == "lock") { ErlType erlType = message.getValue("value") as ErlType; if (erlType.getValueString() == "ok") { StarSoulManager manager = StarSoulManager.Instance; manager.updateStarSoulLockState(); StarSoulManager.Instance.cleanDic(); StorageManagerment.Instance.starSoulStorageVersion++; } else { UiManager.Instance.openDialogWindow <MessageWindow> ((win) => { win.initWindow(1, LanguageConfigManager.Instance.getLanguage("s0093"), null, erlType.getValueString(), null); }); } if (callback != null) { callback(); callback = null; } } }
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); }
/** 更新button文本 */ public void updateLabelTextUI() { incItem.gameObject.SetActive(false); StarSoulConfigManager configManager = StarSoulConfigManager.Instance; StarSoulManager manager = StarSoulManager.Instance; buttonHunt.textLabel.text = LanguageConfigManager.Instance.getLanguage("StarSoulWindow_button_Hunt", Convert.ToString(1)); UserManager userManger = UserManager.Instance; StorageManagerment smanager = StorageManagerment.Instance; moneyLabel.text = Convert.ToString(userManger.self.getMoney()); rmbLabel.text = Convert.ToString(userManger.self.getRMB()); suipianLabel.text = Convert.ToString(manager.getDebrisNumber()); int maxCount = smanager.getHuntStarSoulStorageMaxSpace(); int remainNum = smanager.getFreeSize(); maxCount = remainNum >= maxCount ? maxCount : remainNum; huntNumber = maxCount; if (currentTapIndex == StarSoulConfigManager.HUNT_MONEY_TYPE) { huntNumber = userManger.self.getMoney() / configManager.getHuntConsumeMoney(currentNebulaIndex); if (huntNumber > maxCount) { huntNumber = maxCount; } string moneyColorText = configManager.isEnoughByHuntMoney(1, currentNebulaIndex)?"[FFFFFF]":"[FF0000]"; consumeLabel.text = moneyColorText + LanguageConfigManager.Instance.getLanguage("s0449", Convert.ToString(configManager.getHuntConsumeMoney(currentNebulaIndex))); consumeIcon.spriteName = "icon_money"; } else if (currentTapIndex == StarSoulConfigManager.HUNT_RMB_TYPE) { huntNumber = userManger.self.getRMB() / configManager.getHuntConsumeRmb(); if (huntNumber > maxCount) { huntNumber = maxCount; } string rmbColorText = configManager.isEnoughByHuntRMB(1)?"[FFFFFF]":"[FF0000]"; consumeLabel.text = rmbColorText + LanguageConfigManager.Instance.getLanguage("s0449", Convert.ToString(configManager.getHuntConsumeRmb())); consumeIcon.spriteName = "rmb"; } if (huntNumber <= 1) { huntNumber = maxCount; } starSoulExp.text = manager.getStarSoulExp().ToString(); }
private void noStarSoulClick(GameObject obj) { //MaskWindow.UnlockUI(); if (starSoul == null && flagChange != CardBookWindow.CLICKCHATSHOW && StarSoulManager.Instance.checkBroeOpenLev(currentcard, currentStarBroeIndex + 1)) { //没有星魂用于装配 UiManager.Instance.openWindow <StarSoulStoreAloneWindow>((win) => { StarSoulManager manager = StarSoulManager.Instance; manager.setActiveInfo(currentcard, currentStarBroeIndex + 1); win.init(currentcard, starSoul, ButtonStoreStarSoul.ButtonStateType.PutOn); }); } else { UiManager.Instance.openDialogWindow <MessageLineWindow>((winn) => { winn.Initialize(LanguageConfigManager.Instance.getLanguage("resonancewindow16", StarSoulConfigManager.Instance.getGrooveOpen()[currentStarBroeIndex].ToString())); }); } }
/// <summary> /// 回调读取通讯 /// </summary> /// <param name="message">Message.</param> public override void read(ErlKVMessage message) { int index = 0; ErlType erlType = message.getValue("msg") as ErlType; if (erlType is ErlArray) { ErlArray arr = erlType as ErlArray; StarSoulManager manager = StarSoulManager.Instance; StorageManagerment smanager = StorageManagerment.Instance; // 转化的经验 int exchangeExp = StringKit.toInt(arr.Value [index++].getValueString()); if (exchangeExp > 0) { StarSoulManager.Instance.addStarSoulExp(exchangeExp); } StarSoul[] exchangeStarSouls = null; StarSoul[] popStorageStarSouls = null; // 转换经验的星魂 ErlType exchangeStarSoulType = arr.Value [index++]; if (exchangeStarSoulType is ErlArray) { ErlArray exchangeStarSoulArr = exchangeStarSoulType as ErlArray; if (exchangeStarSoulArr.Value.Length > 0) { exchangeStarSouls = new StarSoul[exchangeStarSoulArr.Value.Length]; StarSoul starSoul; for (int i = 0; i < exchangeStarSoulArr.Value.Length; i++) { starSoul = smanager.getHuntStarSoul(exchangeStarSoulArr.Value[i].getValueString()); if (starSoul == null) { continue; } // 清理猎魂仓库 smanager.delHuntStarSoulStorage(starSoul.uid); // 构建显示数据 exchangeStarSouls[i] = starSoul; } StorageManagerment.Instance.huntStarSoulStorageVersion++; } } // 放入星魂仓库的星魂 ErlType popStorageStarSoulType = arr.Value [index++]; if (popStorageStarSoulType is ErlArray) { ErlArray popStorageStarSoulArr = popStorageStarSoulType as ErlArray; if (popStorageStarSoulArr.Value.Length > 0) { popStorageStarSouls = new StarSoul[popStorageStarSoulArr.Value.Length]; StarSoul starSoul; for (int i = 0; i < popStorageStarSoulArr.Value.Length; i++) { starSoul = smanager.getHuntStarSoul(popStorageStarSoulArr.Value[i].getValueString()); if (starSoul == null) { continue; } // 清理猎魂仓库 smanager.delHuntStarSoulStorage(starSoul.uid); // 添加星魂仓库 smanager.addStarSoulStorage(starSoul, true); // 构建显示数据 popStorageStarSouls[i] = starSoul; } StorageManagerment.Instance.starSoulStorageVersion++; StorageManagerment.Instance.huntStarSoulStorageVersion++; } } if (callback != null) { callback(exchangeExp, exchangeStarSouls, popStorageStarSouls); callback = null; } } else { UiManager.Instance.openDialogWindow <MessageWindow> ((win) => { win.initWindow(1, LanguageConfigManager.Instance.getLanguage("s0093"), null, erlType.getValueString(), null); }); } }
/// <summary> /// 更新数据 /// </summary> public void updateInfo() { StarSoulManager manager = StarSoulManager.Instance; statSoulDebris.text = Convert.ToString(manager.getDebrisNumber()); }
// /// <summary> // /// 一键转化经验通讯 // /// </summary> // /// <param name="storageType">仓库类型(star_soul_storage=星魂仓库,star_soul_draw_storage=猎魂仓库)</param> // /// <param name="callback">Callback.</param> // public void autoExchangeAccess(string storageType,CallBack<int,StarSoul[]> callback) { // this.callback = callback; // ErlKVMessage message = new ErlKVMessage (FrontPort.STARSOUL_AUTO_CONVERT_EXP); // message.addValue ("storage_type", new ErlString (storageType)); // access (message); // } /// <summary> /// 回调读取通讯 /// </summary> /// <param name="message">Message.</param> public override void read(ErlKVMessage message) { int index = 0; ErlType erlType = message.getValue("msg") as ErlType; if (erlType is ErlArray) { ErlArray arr = erlType as ErlArray; StarSoulManager manager = StarSoulManager.Instance; StorageManagerment smanager = StorageManagerment.Instance; // 仓库类型 string storageType = arr.Value [index++].getValueString(); // 转化的经验 int exchangeExp = StringKit.toInt(arr.Value [index++].getValueString()); if (exchangeExp > 0) { manager.addStarSoulExp(exchangeExp); } StarSoul[] exchangeStarSouls = null; StarSoul[] popStorageStarSouls = null; bool isUpdateStorageVersion = false; bool isUpdateHuntStorageVersion = false; // 转换经验的星魂 ErlType exchangeStarSoulType = arr.Value [index++]; if (exchangeStarSoulType is ErlArray) { ErlArray exchangeStarSoulArr = exchangeStarSoulType as ErlArray; if (exchangeStarSoulArr.Value.Length > 0) { exchangeStarSouls = new StarSoul[exchangeStarSoulArr.Value.Length]; StarSoul starSoul = null; for (int i = 0; i < exchangeStarSoulArr.Value.Length; i++) { if (storageType == "star_soul_storage") // 清理星魂仓库 { starSoul = smanager.getStarSoul(exchangeStarSoulArr.Value[i].getValueString()); if (starSoul == null) { continue; } smanager.delStarSoulStorage(starSoul.uid); isUpdateStorageVersion = true; } else if (storageType == "star_soul_draw_storage") // 清理猎魂仓库 { starSoul = smanager.getHuntStarSoul(exchangeStarSoulArr.Value[i].getValueString()); if (starSoul == null) { continue; } smanager.delHuntStarSoulStorage(starSoul.uid); isUpdateHuntStorageVersion = true; } exchangeStarSouls[i] = starSoul; } } } if (isUpdateStorageVersion) { StorageManagerment.Instance.starSoulStorageVersion++; } if (isUpdateHuntStorageVersion) { StorageManagerment.Instance.huntStarSoulStorageVersion++; } if (callback != null) { callback(exchangeExp, exchangeStarSouls); callback = null; } } else { UiManager.Instance.openDialogWindow <MessageWindow> ((win) => { win.initWindow(1, LanguageConfigManager.Instance.getLanguage("s0093"), null, erlType.getValueString(), null); }); } }