/*method */ /** 更新条目 */ public void updateItem(Exchange exchange, WindowBase win) { initFather(win); role.onClickCallback = rideHander; temp = exchange.getExchangeSample(); Mounts activeMounts = MountsManagerment.Instance.getMountsBySid(temp.exchangeSid); if (activeMounts != null) { storeButton.gameObject.SetActive(true); if (activeMounts.isInUse()) { storeButton.UpdateResultButton(activeMounts, Bgeneralscrollview.ButtonStateType.stop); stateType = IS_CAN_STOP; } else { storeButton.UpdateResultButton(activeMounts, Bgeneralscrollview.ButtonStateType.ride); stateType = IS_CAN_RIDE; } updateRide(activeMounts); storeButton.disableButton(false); } else { Mounts exchangeMounts = MountsManagerment.Instance.createMounts(temp.exchangeSid); ExchangeManagerment exchangeManager = ExchangeManagerment.Instance; if (MountsSampleManager.Instance.getMountsSampleBySid(temp.exchangeSid).isShowTime) { storeButton.gameObject.SetActive(false); updateActive(exchangeMounts); } else { //这里开始检查兑换条件 优先检查VIP if (exchangeManager.checkConditionByAll(exchange)) { storeButton.UpdateResultButton(exchangeMounts, Bgeneralscrollview.ButtonStateType.acitve); updateActive(exchangeMounts); storeButton.disableButton(false); stateType = IS_CAN_ACTIVE; } else { storeButton.UpdateResultButton(exchangeMounts, Bgeneralscrollview.ButtonStateType.acitve); updateActive(exchangeMounts); storeButton.disableButton(true); stateType = IS_CAN_UNACTIVE; } } updateSkillInfo(null); } }
/**排处正常骑乘的坐骑 */ private void updateMountList(List <Exchange> exchangeList) { MountsManagerment mountsManagerment = MountsManagerment.Instance; for (int i = 0; i < exchangeList.Count; i++) { Mounts activeMounts = mountsManagerment.getMountsBySid(exchangeList[i].getExchangeSample().exchangeSid); if (activeMounts != null && activeMounts.isInUse()) { exchangeList.RemoveAt(i); break; } } }
/** 更新3D模型 */ private void update3DModel() { if (mount3dModel.transform.childCount > 0) { Utils.RemoveAllChild(mount3dModel.transform); } if (mounts == null) { mountModelShadows.SetActive(true); } else { mountModelShadows.SetActive(false); createMountsModel((obj) => { if (obj != null) { FuBenCardCtrl mountsAnimCtrl = obj.transform.GetChild(0).GetComponent <FuBenCardCtrl> (); Utils.SetLayer(obj, UiManager.Instance.gameCamera.gameObject.layer); if (mountsAnimCtrl != null) { mountsAnimCtrl.playStand(); } if (mounts.isInUse()) { //有坐骑的情况 Transform saddle = mountsAnimCtrl.transform.FindChild("saddle"); Transform mountsRoot = mountsAnimCtrl.transform.parent; //把人插进马 FuBenCardCtrl cardCtrl = createRoleModel(saddle); if (cardCtrl != null) { cardCtrl.playMStand(); //把精灵插进人 updateAngel(cardCtrl); } } } }); } }
public int compare(object o1, object o2) { //排序 先显示激活的(骑乘,非骑乘(品质 品质一样用战斗力)) if (o1 == null) { return(1); } if (o2 == null) { return(-1); } if (!(o1 is Exchange) || !(o2 is Exchange)) { return(0); } Exchange obj1 = (Exchange)o1; Exchange obj2 = (Exchange)o2; ExchangeSample temp1 = obj1.getExchangeSample(); ExchangeSample temp2 = obj2.getExchangeSample(); MountsSample ms1 = MountsSampleManager.Instance.getMountsSampleBySid(temp1.exchangeSid); MountsSample ms2 = MountsSampleManager.Instance.getMountsSampleBySid(temp2.exchangeSid); if (ms1.sortIndex < ms2.sortIndex) { return(1); } MountsManagerment manager = MountsManagerment.Instance; Mounts isHave1 = manager.getMountsBySid(temp1.exchangeSid); Mounts isHave2 = manager.getMountsBySid(temp2.exchangeSid); if (isHave1 != null && isHave2 != null) { int quality1 = isHave1.getQualityId(); int quality2 = isHave2.getQualityId(); if (isHave1.isInUse()) { return(-1); } else if (isHave2.isInUse()) { return(1); } else { if (quality1 == quality2) { int combat1 = isHave1.getMaxLevel(); int combat2 = isHave2.getMaxLevel(); if (combat1 > combat2) { return(-1); } if (combat1 < combat2) { return(1); } return(0); } else if (quality1 > quality2) { return(-1); } else { return(1); } } } else if (isHave1 != null && isHave2 == null) { return(-1); } else if (isHave1 == null && isHave2 != null) { return(1); } else if (isHave1 == null && isHave2 == null) { ExchangeManagerment instanc = ExchangeManagerment.Instance; if (((instanc.isCheckPremises(temp1, 0) && instanc.isCheckConditions(temp1, 0)) || instanc.isCheckPremises(temp1, 1)) && (!(instanc.isCheckPremises(temp2, 0) && instanc.isCheckConditions(temp2, 0)) || !instanc.isCheckPremises(temp2, 1))) { return(-1); } if (((instanc.isCheckPremises(temp2, 0) && instanc.isCheckConditions(temp2, 0)) || instanc.isCheckPremises(temp2, 1)) && (!(instanc.isCheckPremises(temp1, 0) && instanc.isCheckConditions(temp1, 0)) || !instanc.isCheckPremises(temp1, 1))) { return(1); } } return(0); }