private float totalHeight() { bCalcHeight = true; curUIPos = Vector2.zero; if (tItem != null) { float num = (float)(int)((float)tItem.CurIcon().width * 0.4f); float b = (float)(int)((float)tItem.CurIcon().height * 0.4f); GUIStyle style = GUI.skin.GetStyle("Label"); float a = style.CalcHeight(new GUIContent(tItem.Name), size.x - num - 8f); curUIPos.y += Mathf.Max(a, b); curUIPos.y += 24f; curUIPos.y += 4f; style = GUI.skin.GetStyle("MiniLabel"); float num2 = style.CalcHeight(new GUIContent(StringMgr.Instance.Get(tItem.comment)), size.x - 16f); curUIPos.y += num2; curUIPos.y += brunchGap; curUIPos.y = property.GagueHeight(curUIPos.y); if (good != null && good.GetCashback() > 0) { curUIPos.y += brunchGap; curUIPos.y += 18f; } DoPriceTag(); DoAmount(); curUIPos.y += 10f; } bCalcHeight = false; return(curUIPos.y); }
public override bool DoDialog() { bool result = false; GUISkin skin = GUI.skin; GUI.skin = GUISkinFinder.Instance.GetGUISkin(); DoResultEffect(); GUI.BeginGroup(new Rect(((float)Screen.width - tmpSize.x) / 2f, ((float)Screen.height - tmpSize.y) / 2f, tmpSize.x, tmpSize.y)); GUI.Box(new Rect(0f, 0f, tmpSize.x, tmpSize.y), string.Empty, "Window"); GUI.Box(crdOutline, string.Empty, "BoxFadeBlue"); LabelUtil.TextOut(crdText1, StringMgr.Instance.Get("CONGRATULATION"), "Label", new Color(1f, 1f, 1f), GlobalVars.txtEmptyColor, TextAnchor.LowerCenter); string key = resultCode; TItem tItem = TItemManager.Instance.Get <TItem>(key); string optionStringByOption = tItem.GetOptionStringByOption(resultRemain / 86400); string text = string.Format(StringMgr.Instance.Get("TAKE_RANDOM_ITEM"), tItem.Name, optionStringByOption); LabelUtil.TextOut(crdText2, text, "Label", new Color(1f, 1f, 1f), GlobalVars.txtEmptyColor, TextAnchor.LowerCenter); LabelUtil.TextOut(crdText3, StringMgr.Instance.Get("RANDOMBOX_EXP1"), "Label", new Color(1f, 1f, 1f), GlobalVars.txtEmptyColor, TextAnchor.LowerCenter); switch (tItem.type) { case TItem.TYPE.WEAPON: DoWeapon((TWeapon)tItem); break; case TItem.TYPE.CLOTH: DoCostume((TCostume)tItem); break; case TItem.TYPE.ACCESSORY: DoAccessory((TAccessory)tItem); break; case TItem.TYPE.CHARACTER: DoCharacter((TCharacter)tItem); break; } if (tItem.CurIcon() == null) { Debug.LogError("Fail to get icon for item " + tItem.CurIcon()); } else { TextureUtil.DrawTexture(crdIcon, tItem.CurIcon(), ScaleMode.StretchToFill); } LabelUtil.TextOut(crdName, tItem.Name, "Label", new Color(0.73f, 0.44f, 0.26f), GlobalVars.txtEmptyColor, TextAnchor.LowerLeft); LabelUtil.TextOut(crdDuration, optionStringByOption, "Label", new Color(0.93f, 0.55f, 0.33f), GlobalVars.txtEmptyColor, TextAnchor.LowerRight); if (GlobalVars.Instance.MyButton(crdBtnConfirm, StringMgr.Instance.Get("OK"), "BtnAction")) { result = true; } GUI.EndGroup(); if (!ContextMenuManager.Instance.IsPopup) { WindowUtil.EatEvent(); } GUI.skin = skin; return(result); }
private void DoLevelupCompensation(string badgeName) { string text = string.Format(StringMgr.Instance.Get("TITLE_LEVELUP"), badgeName) + " :"; LabelUtil.TextOut(crdCompenTitle, text, "Label", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); LevelUpCompensation curCompensation = LevelUpCompensationManager.Instance.getCurCompensation(myLv); if (curCompensation == null) { LabelUtil.TextOut(crdNoLevelupComp, StringMgr.Instance.Get("NO_LEVELUP_COMPENSATION"), "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); } else { TItem tItem = null; Texture2D texture2D = null; string empty = string.Empty; switch (curCompensation.amount) { case 0: tItem = TItemManager.Instance.Get <TItem>(curCompensation.code); if (tItem != null) { texture2D = tItem.CurIcon(); empty = ((curCompensation.opt < 1000000) ? (tItem.Name + " (" + curCompensation.opt.ToString() + " " + StringMgr.Instance.Get("DAYS") + ")") : (tItem.Name + " (" + StringMgr.Instance.Get("INFINITE") + ")")); if (texture2D != null) { TextureUtil.DrawTexture(crdItemIcon4LC, texture2D); } LabelUtil.TextOut(crdDetail4LC, empty, "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleLeft); } break; case 1: tItem = TItemManager.Instance.Get <TItem>(curCompensation.code); if (tItem != null) { texture2D = tItem.CurIcon(); empty = ((curCompensation.opt < 1000000) ? (tItem.Name + " (" + curCompensation.opt.ToString() + " " + StringMgr.Instance.Get("TIMES_UNIT") + ")") : (tItem.Name + " (" + StringMgr.Instance.Get("INFINITE") + ")")); if (texture2D != null) { TextureUtil.DrawTexture(crdItemIcon4LC, texture2D); } LabelUtil.TextOut(crdDetail4LC, empty, "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleLeft); } break; case 2: texture2D = iconPoint; empty = StringMgr.Instance.Get("POINT") + " ( " + curCompensation.opt.ToString() + " ) "; if (texture2D != null) { TextureUtil.DrawTexture(crdFPIcon4LC, texture2D); } LabelUtil.TextOut(crdDetail4LC, empty, "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleLeft); break; } } }
private IEnumerator LoadIcon(IconReq req) { Property prop = BuildOption.Instance.Props; string url = "http://" + prop.GetResourceServer + "/BfData/" + req.iconPath; req.CDN = new WWW(url); yield return((object)req.CDN); TItem tItem = Get <TItem>(req.code); if (tItem != null) { Texture2D icon = new Texture2D(167, 91, TextureFormat.RGBA32, mipmap: false) { wrapMode = TextureWrapMode.Clamp }; if (icon.LoadImage(req.CDN.bytes)) { tItem.SetIcon(icon); tItem.CurIcon().Apply(); } } req.CDN.Dispose(); req.CDN = null; iconRequesting = false; }
public void NextMemoDelete() { if (memoDelList.Count != 0) { Memo memo = memoDelList[0]; if (memo.attached != "000") { TItem tItem = TItemManager.Instance.Get <TItem>(memo.attached); if (tItem != null && null != tItem.CurIcon()) { memoDelList.Clear(); SystemMsgManager.Instance.ShowMessage(StringMgr.Instance.Get("MEMO_BOX_WARING02")); } else { CSNetManager.Instance.Sock.SendCS_DEL_MEMO_REQ(memo.seq); memoDelList.RemoveAt(0); } } else { CSNetManager.Instance.Sock.SendCS_DEL_MEMO_REQ(memo.seq); memoDelList.RemoveAt(0); } } }
private void DrawItemIcon(TItem item, Rect crdIcon) { Color color = GUI.color; TextureUtil.DrawTexture(crdIcon, item.CurIcon(), ScaleMode.ScaleToFit); GUI.color = color; }
private void ShowGood() { GUI.Box(crdOutline, string.Empty, "BoxFadeBlue"); if (good != null && tItem != null && null != tItem.CurIcon()) { Texture2D texture2D = null; switch (buyHow) { case Good.BUY_HOW.GENERAL_POINT: texture2D = fpIcon; break; case Good.BUY_HOW.BRICK_POINT: texture2D = bpIcon; break; case Good.BUY_HOW.CASH_POINT: texture2D = TokenManager.Instance.currentToken.mark; break; } TextureUtil.DrawTexture(new Rect(crdOutline.x + 32f, crdOutline.y + (crdOutline.height - (float)tItem.CurIcon().height) / 2f, (float)tItem.CurIcon().width, (float)tItem.CurIcon().height), tItem.CurIcon()); Vector2 pos = new Vector2(crdOutline.x + crdOutline.width - 20f, crdOutline.y + 20f); LabelUtil.TextOut(pos, tItem.Name, "Label", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperRight); pos.y += 32f; LabelUtil.TextOut(pos, good.GetRemainString(selected, buyHow), "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperRight); pos.y += 32f; if (texture2D != null) { TextureUtil.DrawTexture(crdMoneyIcon, texture2D); pos.x -= crdMoneyIcon.width + 10f; } LabelUtil.TextOut(pos, good.GetPriceString(selected, buyHow), "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperRight); } }
public void InitDialog(long seq, int index, string code, int amount, bool wasKey) { TItem tItem = TItemManager.Instance.Get <TItem>(code); if (tItem != null) { itemName.textKey = tItem.name; itemIcon.texImage = tItem.CurIcon(); property.sizeX = background.area.x - 30f; property.Start(); property.tItem = tItem; TooltipProperty tooltipProperty = property; Vector2 showPosition = itemName.showPosition; tooltipProperty.categoryPosX = showPosition.x; TooltipProperty tooltipProperty2 = property; Vector2 showPosition2 = itemName.showPosition; tooltipProperty2.categoryPosY = showPosition2.y + 18f; itemTime.SetText(property.tItem.GetOptionStringByOption(amount)); itemExplain.textKey = tItem.comment; if (wasKey) { itemBackNomal.IsDraw = false; itemBackRare.IsDraw = true; } else { itemBackNomal.IsDraw = true; itemBackRare.IsDraw = false; } RareTextAdd(); } }
private void ShowPresent() { GUI.Box(crdPresentOutline, string.Empty, "BoxFadeBlue"); if (good != null && tItem != null && null != tItem.CurIcon()) { TextureUtil.DrawTexture(new Rect(crdPresentOutline.x + 20f, crdPresentOutline.y + 20f, (float)tItem.CurIcon().width, (float)tItem.CurIcon().height), tItem.CurIcon()); Vector2 pos = new Vector2(crdPresentOutline.x + crdPresentOutline.width - 20f, crdPresentOutline.y + 20f); LabelUtil.TextOut(pos, tItem.Name, "MiniLabel", new Color(0.83f, 0.49f, 0.29f), GlobalVars.txtEmptyColor, TextAnchor.UpperRight); pos.y += 20f; LabelUtil.TextOut(pos, good.GetRemainString(selected, buyHow), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperRight); pos.y += 20f; LabelUtil.TextOut(pos, good.GetPriceString(selected, buyHow), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperRight); } }
public void ResetPcbangItems() { if (FakePcbangItems != null) { for (int i = 0; i < FakePcbangItems.Length; i++) { MyInfoManager.Instance.Erase(FakePcbangItems[i].Seq); FakePcbangItems[i] = null; } } if (BuffManager.Instance.IsPCBangBuff()) { FakePcbangItems = new Item[0]; if (BuildOption.Instance.Props.usePCBangItem) { PCBangBenefit[] array = new PCBangBenefit[pcbangItems.Length]; for (int j = 0; j < pcbangItems.Length; j++) { string text = pcbangItems[j]; TItem tItem = TItemManager.Instance.Get <TItem>(text); if (tItem == null) { Debug.LogError("Fail to find item template for " + text); } else { array[j] = new PCBangBenefit(); array[j].texImage = tItem.CurIcon(); array[j].textKey = tItem.name; } } ((PCBangDialog)DialogManager.Instance.GetDialogAlways(DialogManager.DIALOG_INDEX.PC_BANG_NOTICE))?.ResetBenerfitList(array); } } else { FakePcbangItems = new Item[pcbangItems.Length]; for (int k = 0; k < pcbangItems.Length; k++) { string code = pcbangItems[k]; MyInfoManager.Instance.SetItem(--StartItemIndex, code, Item.USAGE.DELETED, 100000, 2, 100000); FakePcbangItems[k] = MyInfoManager.Instance.GetItemBySequence(StartItemIndex); } } }
public void NextMemoReceiceItem() { if (memoDelList.Count != 0) { Memo memo = memoDelList[0]; if (memo.attached != "000") { TItem tItem = TItemManager.Instance.Get <TItem>(memo.attached); if (tItem != null && null != tItem.CurIcon()) { CSNetManager.Instance.Sock.SendCS_RCV_PRESENT_REQ(memo.seq, memo.attached, memo.option, tItem.IsAmount); memoDelList.RemoveAt(0); } } if (memoDelList.Count == 0) { SystemMsgManager.Instance.ShowMessage(StringMgr.Instance.Get("MEMO_BOX_WARING03")); } } }
public override bool DoDialog() { bool result = false; LabelUtil.TextOut(new Vector2(20f, 30f), StringMgr.Instance.Get("TUTO_MAPEDIT_STARTPUP"), "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft, 390f); int num = 0; int num2 = 0; for (int i = 0; i < itemCodes.Length; i++) { TItem tItem = TItemManager.Instance.Get <TItem>(itemCodes[i]); if (tItem != null) { Rect rc = new Rect(crdStartBtn.x + (float)num, crdStartBtn.y + (float)num2, 167f, 91f); if (GlobalVars.Instance.MyButton(rc, tItem.CurIcon(), new GUIContent(string.Empty, string.Empty), "BtnItemTuto")) { sel = i; selTItem = tItem; crdSel = new Rect(rc.x - 1f, rc.y - 1f, 169f, 92f); } } num = ((i != 2) ? (num + 187) : 0); if (i == 2) { num2 += 107; } } GUI.Box(crdExpl, string.Empty, "BoxInnerLine"); if (sel >= 0 && selTItem != null) { float x = crdExpl.x + 15f; float num3 = crdExpl.y + 15f; LabelUtil.TextOut(new Vector2(x, num3), selTItem.Name, "Label", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); LabelUtil.TextOut(new Vector2(x, num3 + 30f), StringMgr.Instance.Get(selTItem.comment), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft, 200f); GUI.Box(crdSel, string.Empty, "ViewSelected"); } if (GlobalVars.Instance.MyButton(crdOk, StringMgr.Instance.Get("OK"), "BtnAction")) { GlobalVars.Instance.isLoadBattleTutor = true; if (!Application.CanStreamedLevelBeLoaded("Lobby") || !Application.CanStreamedLevelBeLoaded("BattleTutor")) { MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("STREAMING_WAIT")); } else { Channel tutorialableChannel = ChannelManager.Instance.GetTutorialableChannel(); if (tutorialableChannel == null) { if (ChannelManager.Instance.IsLastError()) { MessageBoxMgr.Instance.AddMessage(ChannelManager.Instance.GetBestChannelLastError()); } else { MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("SERVICE_CROWDED")); } } else { Compass.Instance.SetDestination(Compass.DESTINATION_LEVEL.BATTLE_TUTOR, tutorialableChannel.Id); } } result = true; } if (GlobalVars.Instance.MyButton(crdCancel, StringMgr.Instance.Get("CANCEL"), "BtnAction")) { if (!Application.CanStreamedLevelBeLoaded("Lobby")) { MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("STREAMING_WAIT")); } else { Channel bestPlayChannel = ChannelManager.Instance.GetBestPlayChannel(); if (bestPlayChannel == null) { if (ChannelManager.Instance.IsLastError()) { MessageBoxMgr.Instance.AddMessage(ChannelManager.Instance.GetBestChannelLastError()); } else { MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("SERVICE_CROWDED")); } } else { Compass.Instance.SetDestination(Compass.DESTINATION_LEVEL.LOBBY, bestPlayChannel.Id); } } result = true; } Rect rc2 = new Rect(size.x - 44f, 5f, 34f, 34f); if (GlobalVars.Instance.MyButton(rc2, string.Empty, "BtnClose") || GlobalVars.Instance.IsEscapePressed()) { result = true; } return(result); }
public override bool DoDialog() { bool result = false; GUISkin skin = GUI.skin; GUI.skin = GUISkinFinder.Instance.GetGUISkin(); DoMainTitle(); GUI.Box(crdTabOutLine, string.Empty, "BoxPopLine"); mainTab = GUI.SelectionGrid(crdMainTab, mainTab, mainTabstrs, mainTabstrs.Length, "popTab"); if (mainTab != mainTabPre) { if (!ChangePackPossible()) { mainTab = mainTabPre; } else { mainTabPre = mainTab; reset(); SetStep(STEP.READY); } } DoRandomPanel(); GUI.Box(crdBrickPoint, string.Empty, "BoxFadeBlue"); string text = string.Format(StringMgr.Instance.Get("CURRENT_TOKEN"), MyInfoManager.Instance.Cash); LabelUtil.TextOut(crdBrickPointStr, text, "Label", new Color(0.83f, 0.49f, 0.29f), GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter); GUI.Box(crdChipItemBack, string.Empty, "BoxInnerLine"); c_Gachapon[] gachaponsByCat = RandomboxItemManager.Instance.GetGachaponsByCat(mainTab); int num = gachaponsByCat.Length; int num2 = 2; int num3 = num / num2; if (num % num2 > 0) { num3++; } Vector2 vector = new Vector2(135f, 108f); float num4 = vector.x * (float)num2; if (num2 > 1) { num4 += (float)((num2 - 1) * 2); } float num5 = vector.y * (float)num3; if (num3 > 1) { num5 += (float)((num3 - 1) * 4); } Rect viewRect = new Rect(0f, 0f, num4, num5); scrollPosition[mainTab] = GUI.BeginScrollView(crdItemList, scrollPosition[mainTab], viewRect, alwaysShowHorizontal: false, alwaysShowVertical: false); Rect position = new Rect(0f, 0f, vector.x, vector.y); int num6 = 0; int num7 = 0; while (num6 < num && num7 < num3) { position.y = (float)num7 * (vector.y + 2f); int num8 = 0; while (num6 < num && num8 < num2) { position.x = (float)num8 * (vector.x + 2f) + 20f; GUI.BeginGroup(position); if (num6 == 0 && gachaponCode == string.Empty) { gachaponCode = gachaponsByCat[num6].code; selectedBtn = 0; } if (GlobalVars.Instance.MyButton(crdItems, string.Empty, "BtnItem") && ChangePackPossible()) { gachaponCode = gachaponsByCat[num6].code; selectedBtn = num6; SetStep(STEP.READY); } if (selectedBtn == num6) { GUI.Box(crdItems, string.Empty, "ViewSelected"); } crdItemTitle.x = (crdItems.x + crdItems.width) / 2f; LabelUtil.TextOut(crdItemTitle, StringMgr.Instance.Get(gachaponsByCat[num6].strtblCode), "Label", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.LowerCenter); string text2 = string.Format(StringMgr.Instance.Get("NUM_TOKEN"), gachaponsByCat[num6].brickPoint, TokenManager.Instance.GetTokenString()); crdItemBrickPoint.x = (crdItems.x + crdItems.width) / 2f; LabelUtil.TextOut(crdItemBrickPoint, text2, "Label", new Color(1f, 1f, 1f), GlobalVars.txtEmptyColor, TextAnchor.LowerCenter); if (gachaponsByCat[num6].icon == null) { Debug.LogError("Fail to get icon for item " + gachaponsByCat[num6].code); } else { TextureUtil.DrawTexture(crdItemBtn, gachaponsByCat[num6].icon, ScaleMode.StretchToFill); } GUI.EndGroup(); num6++; num8++; } num7++; } GUI.EndScrollView(); bool enabled = GUI.enabled; GUI.enabled = (step == STEP.READY || step == STEP.WAIT_RETRY); if (GlobalVars.Instance.MyButton(crdStartBtn, StringMgr.Instance.Get("START"), "BtnChat") && MyInfoManager.Instance.BrickPoint < gachaponsByCat[selectedBtn].brickPoint) { MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("NOT_ENOUGH_BRICKPOINT4RANDOMBOX")); } GUI.enabled = enabled; string text3 = string.Format(StringMgr.Instance.Get("COMPOSE_GOODS")); LabelUtil.TextOut(crdTitleStr, text3, "Label", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.LowerCenter); Rect position2 = new Rect((float)ud_startx, (float)ud_starty, 143f, 112f); for (int i = 0; i < 5; i++) { if (!(gachaponCode == string.Empty)) { int num9 = gachaponsByCat[selectedBtn].qualities[i]; string key = gachaponsByCat[selectedBtn].items[i]; TItem tItem = TItemManager.Instance.Get <TItem>(key); position2.x = (float)(i * 145 + 13); GUI.Button(position2, new GUIContent(string.Empty, key), "InvisibleButton"); GUI.BeginGroup(position2); Rect position3 = new Rect(0f, 0f, 143f, 112f); if (num9 == 1) { GUI.Box(position3, string.Empty, "BoxRareItemBg"); } else { GUI.Box(position3, string.Empty, "BoxNormalItemBg"); } if (num9 == 1) { LabelUtil.TextOut(crdUdItemTitle, tItem.Name, "Label", new Color(1f, 1f, 1f), GlobalVars.txtEmptyColor, TextAnchor.LowerCenter); } else { LabelUtil.TextOut(crdUdItemTitle, tItem.Name, "Label", new Color(1f, 1f, 1f), GlobalVars.txtEmptyColor, TextAnchor.LowerCenter); } if (tItem.CurIcon() == null) { Debug.LogError("Fail to get icon for item " + tItem.CurIcon()); } else { TextureUtil.DrawTexture(crdUdItemBtn, tItem.CurIcon(), ScaleMode.StretchToFill); } GUI.EndGroup(); } } Rect rc = new Rect(size.x - 50f, 10f, 34f, 34f); if (GlobalVars.Instance.MyButton(rc, string.Empty, "BtnClose") || GlobalVars.Instance.IsEscapePressed()) { result = true; } DoTooltip(); if (!ContextMenuManager.Instance.IsPopup) { WindowUtil.EatEvent(); } GUI.skin = skin; return(result); }
public override bool DoDialog() { bool result = false; Vector2 pos = new Vector2(size.x / 2f, 15f); LabelUtil.TextOut(pos, bigTitle, "BigLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperCenter); Rect viewRect = new Rect(0f, 0f, viewWidth, viewHeight); Rect position = new Rect(22f, 74f, crdItem.x, 420f); scrollPosition = GUI.BeginScrollView(position, scrollPosition, viewRect, alwaysShowHorizontal: false, alwaysShowVertical: false); Rect position2 = new Rect(0f, 0f, crdItem.x, crdItem.y); float num = 0f; for (int i = 0; i < goods.Length; i++) { TItem tItem = goods[i].tItem; if (tItem != null) { position2.y = (float)i * crdItem.y; GUI.BeginGroup(position2); GUI.Box(crdItemBtn, new GUIContent(string.Empty, tItem.code), "BtnItem"); if (tooltip.ItemCode == tItem.code) { tooltip.ItemCode = tItem.code; ltTooltip = new Vector2(position.x + position2.x + crdItemBtn.width, position.y + position2.y - scrollPosition.y); } if (tItem.CurIcon() == null) { Debug.LogError("Fail to get icon for item " + tItem.code); } else { TextureUtil.DrawTexture(crdItemIcon, tItem.CurIcon(), ScaleMode.ScaleToFit); } Color color = GUI.color; GUI.color = GlobalVars.Instance.txtMainColor; GUI.Label(crdItemBtn, tItem.Name, "MiniLabel"); GUI.color = color; DrawDefaultPrice(goods[i]); if (itemStarGauge != null && itemStarGaugeBg != null) { TextureUtil.DrawTexture(crdStarGauge, itemStarGaugeBg, ScaleMode.StretchToFill); Rect position3 = new Rect(crdStarGauge.x, crdStarGauge.y, crdStarGauge.width * goods[i].starRate, crdStarGauge.height); GUI.BeginGroup(position3); TextureUtil.DrawTexture(new Rect(0f, 0f, crdStarGauge.width, crdStarGauge.height), itemStarGauge, ScaleMode.StretchToFill); GUI.EndGroup(); if (goods[i].starRate > 1f) { float num2 = goods[i].starRate - 1f; position3 = new Rect(crdStarGauge.x, crdStarGauge.y, crdStarGauge.width * num2, crdStarGauge.height); GUI.BeginGroup(position3); TextureUtil.DrawTexture(new Rect(0f, 0f, crdStarGauge.width, crdStarGauge.height), itemStarGauge2, ScaleMode.StretchToFill); GUI.EndGroup(); } } switch (tItem.type) { case TItem.TYPE.WEAPON: percent[i] = DoWeapon((TWeapon)tItem); break; case TItem.TYPE.CLOTH: percent[i] = DoCostume((TCostume)tItem); break; case TItem.TYPE.ACCESSORY: percent[i] = DoAccessory((TAccessory)tItem); break; case TItem.TYPE.CHARACTER: percent[i] = DoCharacter((TCharacter)tItem); break; case TItem.TYPE.BUNDLE: percent[i] = DoBundle((TBundle)tItem); break; } if (sendBuyPacket) { if (goods[i].BuyErr.Length > 0) { LabelUtil.TextOut(new Vector2(crdChkFP.x, crdChkFP.y), goods[i].BuyErr, "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft, 300f); } else if (IsBuy[i]) { LabelUtil.TextOut(new Vector2(crdChkFP.x, crdChkFP.y), StringMgr.Instance.Get("PURCHASE_DONE"), "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); } else { LabelUtil.TextOut(new Vector2(crdChkFP.x, crdChkFP.y), StringMgr.Instance.Get("PURCHASE_DON’T"), "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); } } else { Rect position4 = new Rect(159f, 5f, 21f, 22f); goods[i].Check = GUI.Toggle(position4, goods[i].Check, string.Empty); DoBuyHow(i, percent[i]); DoOptions(i); } GUI.EndGroup(); num += crdItem.y; } } GUI.EndScrollView(); viewHeight = num; bool flag = BuildOption.Instance.IsNetmarble || BuildOption.Instance.IsDeveloper; if (flag) { Vector2 pos2 = new Vector2(size.x / 2f, 510f); LabelUtil.TextOut(pos2, StringMgr.Instance.Get("PURCHASE_POLICY"), "MissionLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperCenter, 400f); Rect rc = new Rect(size.x - 150f, 510f, 120f, 34f); if (GlobalVars.Instance.MyButton(rc, StringMgr.Instance.Get("PURCHASE_POLICY_BUTTON"), "BtnAction")) { if (MyInfoManager.Instance.SiteCode == 1) { Application.OpenURL("http://helpdesk.netmarble.net/HelpStipulation.asp#ach13"); } else if (MyInfoManager.Instance.SiteCode == 11) { Application.OpenURL("http://www.tooniland.com/common/html/serviceRules.jsp#"); } } } if (prevWearType) { bWeared = GUI.Toggle(crdToggle, bWeared, StringMgr.Instance.Get("CHECK_DIRECT_EQUIP")); } bool flag2 = DoReceipt(); bool flag3 = false; if (!flag2) { int tk = 0; int fp = 0; if (!enoughPoint && !flag && DoAutochargedGeneralPointReceipt(ref tk, ref fp)) { string str = string.Format(StringMgr.Instance.Get("AUTO_CHARGING_PURCHASE"), tk, fp, TokenManager.Instance.GetTokenString()); str += " "; str += StringMgr.Instance.Get("ARE_YOU_SURE_BUY"); Rect position5 = new Rect(30f, 620f, 680f, 40f); GUI.Label(position5, str, "Label"); } else { flag3 = true; string text = StringMgr.Instance.Get("NOT_ENOUGH_MONEY"); Rect position6 = new Rect(30f, 620f, 680f, 40f); GUI.Label(position6, text, "Label"); } } if (!IsBuyWorkEnd()) { GUIContent content = new GUIContent(StringMgr.Instance.Get("BUY").ToUpper(), GlobalVars.Instance.iconCart); if (flag3) { GUI.enabled = false; } if (GlobalVars.Instance.MyButton3(crdBuyButton, content, "BtnAction")) { for (int j = 0; j < goods.Length; j++) { IsBuy[j] = goods[j].Check; if (goods[j].Check) { CSNetManager.Instance.Sock.SendCS_BUY_ITEM_REQ(goods[j].tItem.code, (int)buyHow[j], goods[j].GetOption(goods[j].priceSel, buyHow[j]), goods[j].IsAmount, bWeared); } } sendBuyPacket = true; } GUI.enabled = true; } else if (GlobalVars.Instance.MyButton(crdBuyButton, StringMgr.Instance.Get("CLOSE"), "BtnAction")) { ShopManager.Instance.InitAllGoods(); result = true; } Vector2 pos3 = new Vector2(430f, 560f); LabelUtil.TextOut(pos3, StringMgr.Instance.Get("PURCHASE_TOTAL") + " : ", "MissionLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperRight, 360f); Vector2 pos4 = new Vector2(440f, 560f); LabelUtil.TextOut(pos4, StringMgr.Instance.Get("GENERAL_POINT"), "MissionLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); Vector2 pos5 = new Vector2(700f, 560f); LabelUtil.TextOut(pos5, GetTotalPoint(Good.BUY_HOW.GENERAL_POINT), "MissionLabel", (!enoughPoint) ? Color.red : GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperRight); TextureUtil.DrawTexture(new Rect(700f, 565f, (float)iconPoint.width, (float)iconPoint.height), iconPoint, ScaleMode.StretchToFill); if (BuildOption.Instance.Props.useBrickPoint) { pos4.y += 22f; LabelUtil.TextOut(pos4, StringMgr.Instance.Get("BRICK_POINT"), "MissionLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); pos5.y += 22f; LabelUtil.TextOut(pos5, GetTotalPoint(Good.BUY_HOW.BRICK_POINT), "MissionLabel", (!enoughBrick) ? Color.red : GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperRight); TextureUtil.DrawTexture(new Rect(pos5.x, pos5.y + 5f, (float)iconBrick.width, (float)iconBrick.height), iconBrick, ScaleMode.StretchToFill); } Texture2D mark = TokenManager.Instance.currentToken.mark; pos4.y += 22f; LabelUtil.TextOut(pos4, TokenManager.Instance.GetTokenString(), "MissionLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); pos5.y += 22f; LabelUtil.TextOut(pos5, GetTotalPoint(Good.BUY_HOW.CASH_POINT), "MissionLabel", (!enoughCash) ? Color.red : GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperRight); TextureUtil.DrawTexture(new Rect(pos5.x, pos5.y + 5f, 12f, 12f), mark, ScaleMode.StretchToFill); Rect rc2 = new Rect(size.x - 44f, 5f, 34f, 34f); if (GlobalVars.Instance.MyButton(rc2, string.Empty, "BtnClose") || GlobalVars.Instance.IsEscapePressed()) { ShopManager.Instance.InitAllGoods(); result = true; } DoTooltip(new Vector2(base.rc.x, base.rc.y)); if (!ContextMenuManager.Instance.IsPopup) { WindowUtil.EatEvent(); } return(result); }
private void DoShooterTools() { DoShooterToolSlots(); GUI.Box(crdItemActionOutline, string.Empty, "LineBoxBlue"); int num = 0; myItems = MyInfoManager.Instance.GetItemsByCat(0, 5, -1); int num2 = myItems.Length; int num3 = 5; int num4 = num2 / num3; if (num2 % num3 > 0) { num4++; } float num5 = crdItem.x * (float)num3; if (num3 > 1) { num5 += (float)((num3 - 1) * 2); } float num6 = crdItem.y * (float)num4; if (num4 > 0) { num6 -= yOffset; } scrollPositionShooterTool = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, crdShooterToolList.width - 20f, num6), position: crdShooterToolList, scrollPosition: scrollPositionShooterTool, alwaysShowHorizontal: false, alwaysShowVertical: false); float y = scrollPositionShooterTool.y; float num7 = y + crdShooterToolList.height; Rect position = new Rect(0f, 0f, crdItem.x, crdItem.y); num = 0; int num8 = 0; while (num < num2 && num8 < num4) { position.y = (float)num8 * crdItem.y; float y2 = position.y; float num9 = y2 + position.height; int num10 = 0; while (num < num2 && num10 < num3) { if (num9 >= y && y2 <= num7) { position.x = (float)num10 * (crdItem.x + 2f); GUI.BeginGroup(position); TItem tItem = TItemManager.Instance.Get <TItem>(myItems[num].Code); if (tooltip.ItemSeq == myItems[num].Seq.ToString()) { if (num10 < num3 - 2) { ltTooltip = new Vector2(rc.x + crdShooterToolList.x + position.x + position.width, rc.y + crdShooterToolList.y + position.y - y); } else { ltTooltip = new Vector2(rc.x + crdShooterToolList.x + position.x - tooltip.size.x, rc.y + crdShooterToolList.y + position.y - y); } } string str = "BtnItem"; if (tItem.season == 2) { str = "BtnItem2"; } if (GUI.Button(crdItemBtn, new GUIContent(string.Empty, myItems[num].Seq.ToString()), str)) { if (Time.time - lastClickTime > doubleClickTimeout) { lastClickTime = Time.time; if (myItems[num].IsShooterSlotAble) { SetDragItem(myItems[num]); } } else { if (myItems[num].IsShooterSlotAble) { CSNetManager.Instance.Sock.SendCS_SET_SHOOTER_TOOL_REQ((sbyte)curActionSlot, myItems[num].Seq); } ResetDragItem(); } curItem = num; } DrawItemIcon(crdIcon: new Rect(crdItemBtn.x + 4f, crdItemBtn.y + 14f, (float)(int)((double)tItem.CurIcon().width * 0.65), (float)(int)((double)tItem.CurIcon().height * 0.65)), item: myItems[num]); Color color = GUI.color; GUI.color = GlobalVars.Instance.txtMainColor; GUI.Label(crdItemBtn, tItem.Name, "MiniLabel"); GUI.color = color; ShowItemStatus(myItems[num]); LabelUtil.TextOut(crdRemain, myItems[num].GetRemainString(), "MiniLabel", Color.white, new Color(0f, 0f, 0f, 0f), TextAnchor.MiddleRight); DrawStarRate(myItems[num]); if (num == curItem) { GUI.Box(new Rect(crdItemBtn.x - 3f, crdItemBtn.y - 3f, crdItemBtn.width + 6f, crdItemBtn.height + 6f), string.Empty, "BtnItemF"); } GUI.EndGroup(); } num++; num10++; } num8++; } GUI.EndScrollView(); DoShooterToolButtons((0 > curItem || curItem >= myItems.Length) ? null : myItems[curItem]); }
private void DoWeapons() { DoWeaponSlots(); GUI.Box(crdItemWeaponOutline, string.Empty, "LineBoxBlue"); int num = 0; int[] array = new int[4] { 1, 0, 3, 2 }; myItems = MyInfoManager.Instance.GetItemsByCat(0, 1, weaponKind, (weaponKind != 1) ? (-1) : array[mainKind]); int num2 = myItems.Length; int num3 = 5; int num4 = num2 / num3; if (num2 % num3 > 0) { num4++; } float num5 = crdItem.x * (float)num3; if (num3 > 1) { num5 += (float)((num3 - 1) * 2); } float num6 = crdItem.y * (float)num4; if (num4 > 0) { num6 -= yOffset; } Rect position = crdWeaponList; if (weaponKind == 1) { position = crdMainWeaponList; } scrollPositionWeapon = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, position.width - 20f, num6), position: position, scrollPosition: scrollPositionWeapon, alwaysShowHorizontal: false, alwaysShowVertical: false); float y = scrollPositionWeapon.y; float num7 = y + position.height; Rect position2 = new Rect(0f, 0f, crdItem.x, crdItem.y); num = 0; int num8 = 0; while (num < num2 && num8 < num4) { position2.y = (float)num8 * crdItem.y; float y2 = position2.y; float num9 = y2 + position2.height; int num10 = 0; while (num < num2 && num10 < num3) { if (num9 >= y && y2 <= num7) { position2.x = (float)num10 * (crdItem.x + 2f); GUI.BeginGroup(position2); TItem tItem = TItemManager.Instance.Get <TItem>(myItems[num].Code); if (tooltip.ItemSeq == myItems[num].Seq.ToString()) { if (num10 < num3 - 2) { ltTooltip = new Vector2(rc.x + position.x + position2.x + position2.width, rc.y + position.y + position2.y - y); } else { ltTooltip = new Vector2(rc.x + position.x + position2.x - tooltip.size.x, rc.y + position.y + position2.y - y); } } string str = "BtnItem"; if (tItem.season == 2) { str = "BtnItem2"; } if (myItems[num] != null && myItems[num].IsLimitedByStarRate) { str = "BtnItemLock"; } if (GUI.Button(crdItemBtn, new GUIContent(string.Empty, myItems[num].Seq.ToString()), str)) { if (Time.time - lastClickTime > doubleClickTimeout) { lastClickTime = Time.time; if (myItems[num].IsWeaponSlotAble) { SetDragItem(myItems[num]); } } else if (curWeaponSlot < 5 || premiumAccount) { if (myItems[num].IsWeaponSlotAble) { CSNetManager.Instance.Sock.SendCS_SET_WEAPON_SLOT_REQ(curWeaponSlot, myItems[num].Seq); } ResetDragItem(); } curItem = num; } DrawItemIcon(crdIcon: new Rect(crdItemBtn.x + 4f, crdItemBtn.y + 14f, (float)(int)((double)tItem.CurIcon().width * 0.65), (float)(int)((double)tItem.CurIcon().height * 0.65)), item: myItems[num]); if (myItems[num].IsUpgradedItem()) { if (myItems[num].CanUpgradeAble()) { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + 96f, crdItemBtn.y + 60f, 14f, 14f), GlobalVars.Instance.iconUpgrade, ScaleMode.ScaleToFit); } else { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + 95f, crdItemBtn.y + 59f, 16f, 16f), GlobalVars.Instance.iconUpgradeMax, ScaleMode.ScaleToFit); } } if (myItems[num].IsPCBang) { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + 2f, crdItemBtn.y + 50f, 24f, 24f), GlobalVars.Instance.iconPCBang, ScaleMode.ScaleToFit); } Color color = GUI.color; GUI.color = GlobalVars.Instance.txtMainColor; GUI.Label(crdItemBtn, tItem.Name, "MiniLabel"); GUI.color = color; ShowItemStatus(myItems[num]); LabelUtil.TextOut(crdRemain, myItems[num].GetRemainString(), "MiniLabel", Color.white, new Color(0f, 0f, 0f, 0f), TextAnchor.MiddleRight); DrawStarRate(myItems[num]); TWeapon tWeapon = (TWeapon)myItems[num].Template; if (myItems[num].Durability >= 0) { float num11 = (float)myItems[num].Durability / (float)tWeapon.durabilityMax; num11 *= 100f; if (num11 > 10f && num11 <= 30f) { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + crdItemBtn.width / 2f - 24f, crdItemBtn.y + crdItemBtn.height / 2f - 33f, 48f, 46f), GlobalVars.Instance.iconWarnYellow, ScaleMode.StretchToFill); } else if (num11 <= 10f) { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + crdItemBtn.width / 2f - 24f, crdItemBtn.y + crdItemBtn.height / 2f - 33f, 48f, 46f), GlobalVars.Instance.iconWarnRed, ScaleMode.StretchToFill); } } if (num == curItem) { GUI.Box(new Rect(crdItemBtn.x - 3f, crdItemBtn.y - 3f, crdItemBtn.width + 6f, crdItemBtn.height + 6f), string.Empty, "BtnItemF"); } GUI.EndGroup(); } num++; num10++; } num8++; } GUI.EndScrollView(); DoWeaponTab(); DoWeaponButtons((0 > curItem || curItem >= myItems.Length) ? null : myItems[curItem]); }
public override bool DoDialog() { bool result = false; GUISkin skin = GUI.skin; GUI.skin = GUISkinFinder.Instance.GetGUISkin(); Vector2 pos = new Vector2(size.x / 2f, 15f); LabelUtil.TextOut(pos, StringMgr.Instance.Get("MEMO_BOX"), "BigLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperCenter); GUI.Box(crdOutline, string.Empty, "BoxPopLine"); int num = curTab; curTab = GUI.SelectionGrid(crdTab, curTab, tab, 2, "PopTab"); if (curTab == 0) { Memo[] array = MemoManager.Instance.ToArray(); if (array.Length <= 0) { selectedMemo = -1; } else if (array.Length <= selectedMemo) { selectedMemo = array.Length - 1; } Vector2 zero = Vector2.zero; zero.x = 37f; Rect viewRect = new Rect(0f, 0f, memoSize.x, (memoSize.y + 1f) * (float)array.Length); bool flag = selectAll; selectAll = GUI.Toggle(crdSelectAll, selectAll, StringMgr.Instance.Get("MEMO_BOX_SELECT_ALL")); if (flag != selectAll) { MemoAllCheckUnCheck(selectAll); } spList = GUI.BeginScrollView(crdMemoList, spList, viewRect); for (int i = 0; i < array.Length; i++) { zero.y = DoMemo(i, array[i], zero); } if (selectedMemo >= 0) { GUI.Box(crdSelected, string.Empty, "BtnBlueF"); } GUI.EndScrollView(); GUI.enabled = (IsCheckedMemo() ? true : false); if (GlobalVars.Instance.MyButton(crdGet, StringMgr.Instance.Get("RECEIVING"), "BtnAction")) { bool flag2 = true; Memo memo = null; bool isAmount = false; for (int j = 0; j < array.Length; j++) { if (array[j].check) { if (array[j].attached != "000") { TItem tItem = TItemManager.Instance.Get <TItem>(array[j].attached); if (tItem != null && null != tItem.CurIcon()) { if (flag2) { flag2 = false; memo = array[j]; isAmount = tItem.IsAmount; } memoDelList.Add(array[j]); } else { array[j].check = false; } } else { array[j].check = false; } } } if (memo != null) { CSNetManager.Instance.Sock.SendCS_RCV_PRESENT_REQ(memo.seq, memo.attached, memo.option, isAmount); memoDelList.RemoveAt(0); } } GUI.enabled = true; GUI.enabled = (IsCheckedMemo() ? true : false); if (GlobalVars.Instance.MyButton(crdDelete, StringMgr.Instance.Get("DELETE"), "BtnAction") && IsCheckedMemo()) { bool flag3 = true; for (int k = 0; k < array.Length; k++) { if (array[k].check) { if (!(array[k].attached != "000")) { break; } TItem tItem2 = TItemManager.Instance.Get <TItem>(array[k].attached); if (tItem2 == null || !(null != tItem2.CurIcon())) { break; } flag3 = false; SystemMsgManager.Instance.ShowMessage(StringMgr.Instance.Get("MEMO_BOX_WARING02")); } } bool flag4 = true; long num2 = -1L; if (flag3) { for (int l = 0; l < array.Length; l++) { if (array[l].check) { memoDelList.Add(array[l]); if (flag4) { flag4 = false; num2 = array[l].seq; } } } if (num2 >= 0) { CSNetManager.Instance.Sock.SendCS_DEL_MEMO_REQ(num2); memoDelList.RemoveAt(0); } } } GUI.enabled = true; Color clrText = Color.white; if (array.Length >= 80) { clrText = Color.red; } LabelUtil.TextOut(crdTotMemo, array.Length.ToString() + " / 100", "Label", clrText, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); } else { LabelUtil.TextOut(crdReceiverLabel, StringMgr.Instance.Get("MEMO_RCV"), "Label", txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperRight); string text = receiver; GUI.SetNextControlName("MemoReceiverInput"); receiver = GUI.TextField(crdReceiverTxtFld, receiver); if (receiver.Length > maxId) { receiver = text; } LabelUtil.TextOut(crdTitleLabel, StringMgr.Instance.Get("MEMO_TITLE"), "Label", txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperRight); string text2 = title; GUI.SetNextControlName("MemoTitleInput"); title = GUI.TextField(crdTitleTxtFld, title); if (title.Length > maxTitle) { title = text2; } GUI.SetNextControlName("MemoContentsInput"); contents = GUI.TextArea(crdMemoTextArea, contents, maxMemoLength); if (GlobalVars.Instance.MyButton(crdSendBtn, StringMgr.Instance.Get("SEND_MEMO"), "BtnAction")) { receiver.Trim(); title.Trim(); if (receiver.Length <= 0) { MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("INPUT_MEMO_RECEIVER")); } else if (title.Length <= 0) { MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("INPUT_MEMO_TITLE")); } else { string a = MyInfoManager.Instance.Nickname.ToLower(); string b = receiver.ToLower(); if (a == b) { MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("CANNOT_SELF_MEMO")); } else { CSNetManager.Instance.Sock.SendCS_SEND_MEMO_REQ(receiver, title, contents); result = true; } } } if (focusingControlName.Length > 0) { Dialog top = DialogManager.Instance.GetTop(); if (top != null && top.ID == id) { GUI.FocusControl(focusingControlName); focusingControlName = string.Empty; } } } if (num == 0 && curTab != 0 && receiver.Length <= 0 && title.Length <= 0 && contents.Length <= 0) { focusingControlName = "MemoReceiverInput"; } Rect rc = new Rect(size.x - 50f, 10f, 34f, 34f); if (GlobalVars.Instance.MyButton(rc, string.Empty, "BtnClose") || GlobalVars.Instance.IsEscapePressed()) { result = true; } GUI.skin = skin; if (MemoManager.Instance.GetMemoCountPercent() >= 100 && !msgfullDlgOpened) { msgfullDlgOpened = true; MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("MEMO_BOX_WARING01")); } return(result); }
private void DoItems() { uiImages.Draw(); WiseSlot(crdSrcItem, srcItem); WiseSlot(crdAdditiveItem, additiveItem); if (!dstItemNoDraw) { WiseSlot(crdDstItem, dstItem); } GUI.Box(crdItemActionOutline, string.Empty, "LineBoxBlue"); int num = 0; Item source = (srcItem == null) ? dstItem : srcItem; myItems = MyInfoManager.Instance.GetItemsCanMerge(source); int num2 = myItems.Length; int num3 = 5; int num4 = num2 / num3; if (num2 % num3 > 0) { num4++; } float num5 = crdItem.x * (float)num3; if (num3 > 1) { num5 += (float)((num3 - 1) * 2); } float num6 = crdItem.y * (float)num4; if (num4 > 0) { num6 -= yOffset; } scrollPositionShooterTool = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, crdItemList.width - 20f, num6), position: crdItemList, scrollPosition: scrollPositionShooterTool, alwaysShowHorizontal: false, alwaysShowVertical: false); float y = scrollPositionShooterTool.y; float num7 = y + crdItemList.height; Rect position = new Rect(0f, 0f, crdItem.x, crdItem.y); num = 0; int num8 = 0; while (num < num2 && num8 < num4) { position.y = (float)num8 * crdItem.y; float y2 = position.y; float num9 = y2 + position.height; int num10 = 0; while (num < num2 && num10 < num3) { if (num9 >= y && y2 <= num7) { position.x = (float)num10 * (crdItem.x + 2f); GUI.BeginGroup(position); TItem tItem = TItemManager.Instance.Get <TItem>(myItems[num].Code); if (tooltip.ItemSeq == myItems[num].Seq.ToString()) { if (num10 < num3 - 2) { ltTooltip = new Vector2(rc.x + crdItemList.x + position.x + position.width, rc.y + crdItemList.y + position.y - y); } else { ltTooltip = new Vector2(rc.x + crdItemList.x + position.x - tooltip.size.x, rc.y + crdItemList.y + position.y - y); } } string str = "BtnItem"; if (tItem.season == 2) { str = "BtnItem2"; } if (GlobalVars.Instance.MyButton(crdItemBtn, new GUIContent(string.Empty, myItems[num].Seq.ToString()), str) && state != COMBINE_STATE.WAIT) { ResetCombineItem(); additiveItem = myItems[num]; state = COMBINE_STATE.SELECT; curItem = num; AutoFunctionManager.Instance.DeleteAllAutoFunction(); } DrawItemIcon(crdIcon: new Rect(crdItemBtn.x + 4f, crdItemBtn.y + 14f, (float)(int)((double)tItem.CurIcon().width * 0.65), (float)(int)((double)tItem.CurIcon().height * 0.65)), item: myItems[num]); Color color = GUI.color; GUI.color = GlobalVars.Instance.txtMainColor; GUI.Label(crdItemBtn, tItem.Name, "MiniLabel"); GUI.color = color; ShowItemStatus(myItems[num]); LabelUtil.TextOut(crdRemain, myItems[num].GetRemainString(), "MiniLabel", Color.white, new Color(0f, 0f, 0f, 0f), TextAnchor.MiddleRight); if (num == curItem) { GUI.Box(new Rect(crdItemBtn.x - 3f, crdItemBtn.y - 3f, crdItemBtn.width + 6f, crdItemBtn.height + 6f), string.Empty, "BtnItemF"); } GUI.EndGroup(); } num++; num10++; } num8++; } GUI.EndScrollView(); }
private void DoItemList(TItem[] items, Vector2 scrollPosition, Rect posList) { int allItemCount = allItems.Length; int itemsPerRow = 6; int curRow = allItemCount / itemsPerRow; if (allItemCount % itemsPerRow > 0) { curRow++; } float xPosition = crdItem.x * (float)itemsPerRow; if (itemsPerRow > 1) { xPosition += (float)((itemsPerRow - 1) * 2); } float yPosition = crdItem.y * (float)curRow; if (curRow > 0) { yPosition -= this.yOffset; } scrollPosition = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, posList.width - 20f, yPosition), position: posList, scrollPosition: scrollPosition, alwaysShowHorizontal: false, alwaysShowVertical: false); float y = scrollPosition.y; float num7 = y + posList.height; Rect position = new Rect(0f, 0f, crdItem.x, crdItem.y); int _i = 0; int num8 = 0; while (_i < allItemCount && num8 < curRow) { position.y = (float)num8 * crdItem.y; float y2 = position.y; float num9 = y2 + position.height; int num10 = 0; while (_i < allItemCount && num10 < itemsPerRow) { if (num9 >= y && y2 <= num7) { position.x = (float)num10 * (crdItem.x + 2f); GUI.BeginGroup(position); TItem tItem = allItems[_i]; string str = tItem.season == 2 ? "BtnItem2" : "BtnItem"; if (GUI.Button(crdItemBtn, new GUIContent(string.Empty, allItems[_i].Name), str)) { selectedItem = _i; if (Time.time - lastClickTime < doubleClickTimeout) { TItem item = allItems[selectedItem]; if (ClientExtension.instance.inventory.equipment.Exists(x => x.Template.code == item.code)) { // item is in our inventory, so ... Item it = ClientExtension.instance.inventory.equipment.Find(x => x.Template.code == item.code); if (it.Usage == Item.USAGE.EQUIP) { // ... unequip it CSNetManager.Instance.Sock.SendCS_UNEQUIP_REQ(it.Seq); } else if (it.Usage == Item.USAGE.UNEQUIP) { // ... equip it GlobalVars.Instance.PlaySoundItemInstall(); Item slotItem = ClientExtension.instance.inventory.equipment.Find(x => x.Template.slot == item.slot); if (slotItem != null) // slot is already occupied so we need to unequip the current item { CSNetManager.Instance.Sock.SendCS_UNEQUIP_REQ(slotItem.Seq); } CSNetManager.Instance.Sock.SendCS_EQUIP_REQ(it.Seq); } ClientExtension.instance.inventory.UpdateCSV(); ClientExtension.instance.SendInventoryCSV(); } else { // Item isnt in our inventory, so add it ClientExtension.instance.inventory.AddItem(item, true); ClientExtension.instance.inventory.UpdateCSV(); ClientExtension.instance.SendInventoryCSV(); } } else { lastClickTime = Time.time; } } DrawItemIcon(crdIcon: new Rect(crdItemBtn.x + 4f, crdItemBtn.y + 14f, (float)(int)((double)tItem.CurIcon().width * 0.65), (float)(int)((double)tItem.CurIcon().height * 0.65)), item: allItems[_i]); Color color = GUI.color; GUI.color = GlobalVars.Instance.txtMainColor; GUI.Label(crdItemBtn, tItem.Name, "MiniLabel"); GUI.color = color; ShowItemStatus(allItems[_i]); if (_i == selectedItem) { GUI.Box(new Rect(crdItemBtn.x - 3f, crdItemBtn.y - 3f, crdItemBtn.width + 6f, crdItemBtn.height + 6f), string.Empty, "BtnItemF"); } GUI.EndGroup(); } _i++; num10++; } num8++; } GUI.EndScrollView(); }
public override bool Draw() { if (!isDraw) { return(false); } BeginGroup(); base.Draw(); itemScroll.ListResetAddPosition(); itemScroll.SetListCount(tcTItemList.Length); Rect viewRect = new Rect(0f, 0f, itemScroll.offSetX * (float)tcTItemList.Length, itemScroll.area.y - 25f); Vector2 showPosition = itemScroll.showPosition; float x = showPosition.x; Vector2 showPosition2 = itemScroll.showPosition; GUI.BeginScrollView(new Rect(x, showPosition2.y, itemScroll.area.x, itemScroll.area.y), itemScroll.scrollPoint, viewRect); for (int i = 0; i < tcTItemList.Length; i++) { if (tcTItemList[i].isKey) { itemBackNomal.IsDraw = false; itemBackRare.IsDraw = true; } else { itemBackNomal.IsDraw = true; itemBackRare.IsDraw = false; } TItem tItem = TItemManager.Instance.Get <TItem>(tcTItemList[i].code); if (tItem == null) { Debug.LogError("Fail to get TItem for " + tcTItemList[i].code); } else { itemIcon.texImage = tItem.CurIcon(); if (tItem.IsAmount) { itemTime.SetText(tcTItemList[i].opt.ToString() + " " + StringMgr.Instance.Get("TIMES_UNIT")); } else if (tcTItemList[i].opt >= 1000000) { itemTime.SetText(StringMgr.Instance.Get("INFINITE")); } else { itemTime.SetText(tcTItemList[i].opt.ToString() + " " + StringMgr.Instance.Get("DAYS")); } } itemScroll.SetListPostion(i); itemScroll.Draw(); } GUI.EndScrollView(); imgList.Draw(); labelList.Draw(); darkEffect.Draw(); EndGroup(); selectBox.Draw(); changeColor.Draw(); return(false); }
public void DoItem(Rect rcBox, Item item) { if (item != null) { string b = item.Seq.ToString(); GUI.Box(rcBox, new GUIContent(string.Empty, b), "NullWindow"); GUI.BeginGroup(rcBox); TItem tItem = TItemManager.Instance.Get <TItem>(item.Code); if (tooltip.ItemSeq == b) { ltTooltip = new Vector2(rcBox.x + rcBox.width + 5f, rcBox.y); } Rect crdIcon = new Rect(crdItemBtn.x, crdItemBtn.y + 16f, (float)(int)((float)tItem.CurIcon().width * 0.8f), (float)(int)((float)tItem.CurIcon().height * 0.8f)); DrawItemIcon(item, crdIcon); if (item.IsUpgradedItem()) { if (item.CanUpgradeAble()) { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + 110f, crdItemBtn.y + 60f, 14f, 14f), GlobalVars.Instance.iconUpgrade, ScaleMode.ScaleToFit); } else { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + 110f, crdItemBtn.y + 60f, 16f, 16f), GlobalVars.Instance.iconUpgradeMax, ScaleMode.ScaleToFit); } } if (item.IsPCBang) { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + 2f, crdItemBtn.y + 50f, 24f, 24f), GlobalVars.Instance.iconPCBang, ScaleMode.ScaleToFit); } Color color = GUI.color; GUI.color = GlobalVars.Instance.txtMainColor; GUI.Label(crdItemBtn, tItem.Name, "MiniLabel"); GUI.color = color; GUI.EndGroup(); } }
private void DoRandomPanel() { GUI.Box(crdVisualBox, string.Empty, "BoxPopLine"); int num = -1; for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { Rect position = new Rect(crdSlotLT.x + (float)i * (crdSlotSize.x + crdSlotOffset.x), crdSlotLT.y + (float)j * (crdSlotSize.y + crdSlotOffset.y), crdSlotSize.x, crdSlotSize.y); GUI.BeginGroup(position); TextureUtil.DrawTexture(new Rect(0f, 0f, crdSlotSize.x, crdSlotSize.y), tSlot.bg); Texture2D texture2D = null; switch (step) { case STEP.READY: texture2D = tSlot.GetTexture2D(mainTab, i, j, 0); if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } break; case STEP.SHOW_BACK: texture2D = tSlot.GetTexture2D(mainTab, i, j, (!qSlot.Contains(j + i * 3)) ? 2 : 0); if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } if (qSlot.Count > 0 && qSlot.Peek() == j + i * 3) { float num8 = Mathf.Lerp(1.5f, 1f, deltaTime * (1f / focusTime)); texture2D = tSlot.GetTexture2D(mainTab, i, j, 3); if (null != texture2D) { float num9 = (float)texture2D.width * num8; float num10 = (float)texture2D.height * num8; TextureUtil.DrawTexture(new Rect((crdSlotSize.x - num9) / 2f, (crdSlotSize.y - num10) / 2f, num9, num10), texture2D); } } break; case STEP.WAIT_INPUT: { texture2D = tSlot.GetTexture2D(mainTab, i, j, 2); if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } Rect rc = new Rect(base.ClientRect.x + position.x, base.ClientRect.y + position.y, position.width, position.height); if (MouseUtil.MouseOver(rc)) { Color white = Color.white; white = ((!fadeIn) ? Color.Lerp(Color.white, new Color(1f, 1f, 1f, 0f), deltaTime * (1f / flickerTime)) : Color.Lerp(new Color(1f, 1f, 1f, 0f), Color.white, deltaTime * (1f / flickerTime))); Color color = GUI.color; GUI.color = white; texture2D = tSlot.GetTexture2D(mainTab, i, j, 1); if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } GUI.color = color; num = j + i * 3; if (mouseOverBtn != num) { fadeIn = true; deltaTime = flickerTime; } if (Input.GetMouseButtonUp(0)) { CSNetManager.Instance.Sock.SendCS_OPEN_RANDOM_BOX_REQ(Convert.ToInt32(gachaponCode)); SetStep(STEP.SPIN); if (i == 0 && j == 0) { spinIndex = UnityEngine.Random.Range(1, 6); } else { spinIndex = j + i * 3; } } } break; } case STEP.SPIN: if (spinIndex != j + i * 3) { texture2D = tSlot.GetTexture2D(mainTab, i, j, 0); if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } } else { texture2D = tSlot.GetTexture2D(mainTab, i, j, 2); if (null != texture2D) { int num11 = spinning % 3; float num12 = (float)texture2D.height; switch (num11) { case 1: num12 *= 0.7f; break; case 2: num12 *= 0.3f; break; } TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - num12) / 2f, (float)texture2D.width, num12), texture2D); } } break; case STEP.RESULT: if (spinIndex != j + i * 3) { texture2D = tSlot.GetTexture2D(mainTab, i, j, 0); if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } } else { texture2D = tSlot.GetTexture2D(mainTab, i, j, 4); if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } TItem tItem3 = TItemManager.Instance.Get <TItem>(resultCode); if (tItem3 != null) { float num6 = (float)tItem3.CurIcon().width * 0.6f; float num7 = (float)tItem3.CurIcon().height * 0.6f; TextureUtil.DrawTexture(new Rect((crdSlotSize.x - num6) / 2f, (crdSlotSize.y - num7) / 2f, num6, num7), tItem3.CurIcon(), ScaleMode.StretchToFill); } Texture2D texture2D3 = tSlot.fx[resultPhase % 2]; if (null != texture2D3) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D3.width) / 2f, (crdSlotSize.y - (float)texture2D3.height) / 2f, (float)texture2D3.width, (float)texture2D3.height), texture2D3); } } break; case STEP.SHOW_FRONT: if (spinIndex != j + i * 3) { texture2D = tSlot.GetTexture2D(mainTab, i, j, ((i != 0 || j != 0) && !qSlot.Contains(j + i * 3)) ? 4 : 0); if (qSlot.Count > 0 && qSlot.Peek() == j + i * 3) { if (null != texture2D) { int num13 = spinning % 3; float num14 = (float)texture2D.height; switch (num13) { case 1: num14 *= 0.7f; break; case 2: num14 *= 0.3f; break; } TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - num14) / 2f, (float)texture2D.width, num14), texture2D); } TItem tItem4 = (!dicResult.ContainsKey(j + i * 3)) ? null : dicResult[j + i * 3]; if (tItem4 != null) { float num15 = Mathf.Lerp(1.5f, 1f, deltaTime * (1f / focusTime)); texture2D = tItem4.CurIcon(); if (null != texture2D) { float num16 = (float)texture2D.width * num15 * 0.6f; float num17 = (float)texture2D.height * num15 * 0.6f; TextureUtil.DrawTexture(new Rect((crdSlotSize.x - num16) / 2f, (crdSlotSize.y - num17) / 2f, num16, num17), texture2D); } } } else { if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } TItem tItem5 = (!dicResult.ContainsKey(j + i * 3)) ? null : dicResult[j + i * 3]; if (tItem5 != null && !qSlot.Contains(j + i * 3)) { float num18 = (float)tItem5.CurIcon().width * 0.6f; float num19 = (float)tItem5.CurIcon().height * 0.6f; TextureUtil.DrawTexture(new Rect((crdSlotSize.x - num18) / 2f, (crdSlotSize.y - num19) / 2f, num18, num19), tItem5.CurIcon(), ScaleMode.StretchToFill); } } } else { texture2D = tSlot.GetTexture2D(mainTab, i, j, 4); if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } TItem tItem6 = TItemManager.Instance.Get <TItem>(resultCode); if (tItem6 != null) { float num20 = (float)tItem6.CurIcon().width * 0.6f; float num21 = (float)tItem6.CurIcon().height * 0.6f; TextureUtil.DrawTexture(new Rect((crdSlotSize.x - num20) / 2f, (crdSlotSize.y - num21) / 2f, num20, num21), tItem6.CurIcon(), ScaleMode.StretchToFill); } Texture2D texture2D4 = tSlot.fx[resultPhase % 2]; if (null != texture2D4) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D4.width) / 2f, (crdSlotSize.y - (float)texture2D4.height) / 2f, (float)texture2D4.width, (float)texture2D4.height), texture2D4); } } break; case STEP.WAIT_RETRY: if (spinIndex != j + i * 3) { texture2D = tSlot.GetTexture2D(mainTab, i, j, ((i != 0 || j != 0) && !qSlot.Contains(j + i * 3)) ? 4 : 0); if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } TItem tItem = (!dicResult.ContainsKey(j + i * 3)) ? null : dicResult[j + i * 3]; if (tItem != null && !qSlot.Contains(j + i * 3)) { float num2 = (float)tItem.CurIcon().width * 0.6f; float num3 = (float)tItem.CurIcon().height * 0.6f; TextureUtil.DrawTexture(new Rect((crdSlotSize.x - num2) / 2f, (crdSlotSize.y - num3) / 2f, num2, num3), tItem.CurIcon(), ScaleMode.StretchToFill); } } else { texture2D = tSlot.GetTexture2D(mainTab, i, j, 4); if (null != texture2D) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D.width) / 2f, (crdSlotSize.y - (float)texture2D.height) / 2f, (float)texture2D.width, (float)texture2D.height), texture2D); } TItem tItem2 = TItemManager.Instance.Get <TItem>(resultCode); if (tItem2 != null) { float num4 = (float)tItem2.CurIcon().width * 0.6f; float num5 = (float)tItem2.CurIcon().height * 0.6f; TextureUtil.DrawTexture(new Rect((crdSlotSize.x - num4) / 2f, (crdSlotSize.y - num5) / 2f, num4, num5), tItem2.CurIcon(), ScaleMode.StretchToFill); } Texture2D texture2D2 = tSlot.fx[resultPhase % 2]; if (null != texture2D2) { TextureUtil.DrawTexture(new Rect((crdSlotSize.x - (float)texture2D2.width) / 2f, (crdSlotSize.y - (float)texture2D2.height) / 2f, (float)texture2D2.width, (float)texture2D2.height), texture2D2); } } break; } GUI.EndGroup(); } } mouseOverBtn = num; }
public override bool DoDialog() { bool result = false; GUISkin skin = GUI.skin; GUI.skin = GUISkinFinder.Instance.GetGUISkin(); imgList.Draw(); labelList.Draw(); TcStatus[] array = TreasureChestManager.Instance.ToArray(); scrollBoard.ListResetAddPosition(); scrollBoard.SetListCount(array.Length); scrollBoard.BeginScroll(); for (int i = 0; i < scrollBoard.GetListCount(); i++) { TcStatus tcStatus = array[i]; select.IsDraw = (curBoard == i); boardBack.toolTipString = tcStatus.Seq.ToString(); boardName.SetText(tcStatus.GetTitle()); if (tcStatus.TokenPrice == 0) { token.IsDraw = false; tokenCount.IsDraw = false; } else { token.IsDraw = true; tokenCount.IsDraw = true; tokenCount.SetText(tcStatus.TokenPrice.ToString()); } if (tcStatus.CoinPrice == 0) { coin.IsDraw = false; coinCount.IsDraw = false; premium.IsDraw = true; } else { coin.IsDraw = true; coinCount.IsDraw = true; premium.IsDraw = false; coinCount.SetText(tcStatus.CoinPrice.ToString()); } if (BuildOption.Instance.Props.randomBox == BuildOption.RANDOM_BOX_TYPE.INFERNUM) { maxRare.SetListCount(tcStatus.MaxKey); currentRare.SetListCount(tcStatus.Key); count.SetText(tcStatus.GetDescription()); itemIconTable.IsDraw = false; itemTimeTable.IsDraw = false; } else { TcTItem firstRare = tcStatus.GetFirstRare(); if (!firstRare.IsNull()) { TItem tItem = TItemManager.Instance.Get <TItem>(firstRare.code); if (tItem != null) { itemIconTable.IsDraw = true; itemTimeTable.IsDraw = true; premium.IsDraw = false; itemIconTable.texImage = tItem.CurIcon(); if (tItem.IsAmount) { itemTimeTable.SetText(firstRare.opt.ToString() + " " + StringMgr.Instance.Get("TIMES_UNIT")); } else if (firstRare.opt >= 1000000) { itemTimeTable.SetText(StringMgr.Instance.Get("INFINITE")); } else { itemTimeTable.SetText(firstRare.opt.ToString() + " " + StringMgr.Instance.Get("DAYS")); } } else { itemIconTable.IsDraw = false; itemTimeTable.IsDraw = false; } } } scrollBoard.SetListPostion(i); scrollBoard.Draw(); if (boardBack.isClick()) { curBoard = i; if (Time.time - lastClickTime < doubleClickTimeout && clickBoard == curBoard) { doubleClicked = true; } else { lastClickTime = Time.time; clickBoard = curBoard; } } } scrollBoard.EndScroll(); if (curBoard >= 0 && curBoard < array.Length) { TcTItem[] arraySorted = array[curBoard].GetArraySorted(); scrollRare.ListResetAddPosition(); itemLine.ResetAddPosition(); scrollRare.SetListCount(arraySorted.Length); scrollRare.BeginScroll(); for (int j = 0; j < arraySorted.Length; j++) { TItem tItem2 = TItemManager.Instance.Get <TItem>(arraySorted[j].code); if (tItem2 != null) { itemName.textKey = tItem2.name; itemIcon.texImage = tItem2.CurIcon(); itemExplain.textKey = tItem2.comment; if (tItem2.IsAmount) { itemTime.SetText(arraySorted[j].opt.ToString() + " " + StringMgr.Instance.Get("TIMES_UNIT")); } else if (arraySorted[j].opt >= 1000000) { itemTime.SetText(StringMgr.Instance.Get("INFINITE")); } else { itemTime.SetText(arraySorted[j].opt.ToString() + " " + StringMgr.Instance.Get("DAYS")); } if (arraySorted[j].isKey) { itemBackNomal.IsDraw = false; itemBackRare.IsDraw = true; } else { itemBackNomal.IsDraw = true; itemBackRare.IsDraw = false; } scrollRare.SetListPostion(j); bool flag = scrollRare.IsSkipAble(); if (!flag) { scrollRare.Draw(); property.sizeX = size.x - 100f; property.Start(); property.tItem = tItem2; TooltipProperty tooltipProperty = property; Vector2 showPosition = itemName.showPosition; tooltipProperty.categoryPosX = showPosition.x; TooltipProperty tooltipProperty2 = property; Vector2 showPosition2 = itemName.showPosition; tooltipProperty2.categoryPosY = showPosition2.y + 22f; TooltipProperty tooltipProperty3 = property; Vector2 showPosition3 = itemName.showPosition; tooltipProperty3.DoPropertyGuage(showPosition3.y + 2f); } if (j != arraySorted.Length - 1) { if (!flag) { itemLine.Draw(); } itemLine.AddPositionY(scrollRare.offSetY); } } } scrollRare.EndScroll(); } if (exit.Draw() || GlobalVars.Instance.IsEscapePressed()) { result = true; } if ((enter.Draw() || GlobalVars.Instance.IsReturnPressed() || doubleClicked) && curBoard >= 0 && curBoard < array.Length) { CSNetManager.Instance.Sock.SendCS_TC_ENTER_REQ(array[curBoard].Seq); } myTokenHave.SetText(MyInfoManager.Instance.Cash.ToString("n0")); myCoinHave.SetText(MyInfoManager.Instance.FreeCoin.ToString("n0")); myToken.Draw(); myTokenHave.Draw(); myCoinHave.Draw(); if (!ContextMenuManager.Instance.IsPopup) { WindowUtil.EatEvent(); } GUI.skin = skin; return(result); }
public override bool DoDialog() { bool result = false; TextureUtil.DrawTexture(new Rect(0f, 0f, (float)texUpgradeBG.width, (float)texUpgradeBG.height), texUpgradeBG); bubbleEffect.Draw(); myUpgradeItems = MyInfoManager.Instance.GetItemsByCat(0, 7, 0); RemoveNotUseItem(); DoDoctorText(); DoEnergyTank(); Vector2 pos = new Vector2(size.x / 2f, 15f); LabelUtil.TextOut(pos, StringMgr.Instance.Get("ITEM_UPGRADE").ToUpper(), "BigLabel", txtMainClr, GlobalVars.txtEmptyColor, TextAnchor.UpperCenter); TItem template = upgradee.Template; DoItem(crdPanelItem, upgradee); if (strErr.Length > 0) { float x = crdPanelUpgrade.x + crdPanelUpgrade.width / 2f - 90f; float y = crdPanelUpgrade.y + crdPanelUpgrade.height / 2f - 30f; GUI.Label(new Rect(x, y, 210f, 60f), strErr, "MiniLabel"); } else if (curTier >= 0) { TextureUtil.DrawTexture(new Rect(734f, 143f, 90f, 90f), texQuestion, ScaleMode.StretchToFill); } else { UpgradeSelector((int)template.upgradeCategory); } if (bProgess) { if (upgradeState == UPGRADE_STATE.GAUGE_RISE) { GUI.enabled = false; } if (GlobalVars.Instance.MyButton(crdBtnUpgrade, string.Empty, "UpgradeCancel") || GlobalVars.Instance.IsEscapePressed()) { GlobalVars.Instance.StopSound(); AutoFunctionManager.Instance.DeleteAllAutoFunction(); EffectEnd(); bProgess = false; MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("ITEMUPGRADE_CANCELED")); } if (upgradeState == UPGRADE_STATE.GAUGE_RISE) { GUI.enabled = true; } } else { if (!IsEnableUpgradeButton() || upgradeState >= UPGRADE_STATE.WAIT) { GUI.enabled = false; } if (GlobalVars.Instance.MyButton(crdBtnUpgrade, string.Empty, "UpgradeStart") && CanUpgradeXpNLv()) { StartUpgrade(); bProgess = true; } if (!IsEnableUpgradeButton() || upgradeState >= UPGRADE_STATE.WAIT) { GUI.enabled = true; } } int num = myUpgradeItems.Length; if (num > 0) { int num2 = 4; int num3 = num / num2; if (num % num2 > 0) { num3++; } float num4 = crdItem.x * (float)num2; if (num2 > 1) { num4 += (float)((num2 - 1) * 2); } float num5 = crdItem.y * (float)num3; if (num3 > 1) { num5 += (float)((num3 - 1) * 4); } Rect position = new Rect(crdItemStart.x, crdItemStart.y, crdItem.x, crdItem.y); scrollPosition = GUI.BeginScrollView(viewRect: new Rect(crdItemStart.x, crdItemStart.y, crdItemSlotList.width - 20f, num5), position: crdItemSlotList, scrollPosition: scrollPosition, alwaysShowHorizontal: false, alwaysShowVertical: false); int num6 = 0; int num7 = 0; while (num6 < num && num7 < num3) { position.y = crdItemStart.y + (float)num7 * crdItem.y; int num8 = 0; while (num6 < num && num8 < num2) { position.x = crdItemStart.x + (float)num8 * (crdItem.x + 2f); GUI.BeginGroup(position); TItem template2 = myUpgradeItems[num6].Template; string str = "BtnItem"; if (template2.season == 2) { str = "BtnItem2"; } if (GlobalVars.Instance.MyButton(crdItemBtn, new GUIContent(string.Empty, myUpgradeItems[num6].Seq.ToString()), str)) { if (upgradeState == UPGRADE_STATE.NONE) { upgradeState = UPGRADE_STATE.SELECT; } strErr = string.Empty; curItem = num6; } if (tooltip.ItemSeq == myUpgradeItems[num6].Seq.ToString()) { if (position.x < 400f) { ltTooltip = new Vector2(position.x + position.width + 5f, position.y); } else { ltTooltip = new Vector2(position.x - tooltip.size.x - 5f, position.y); } } LabelUtil.TextOut(crdItemName, template2.Name, "MiniLabel", txtMainClr, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); DrawItemIcon(crdIcon: new Rect(crdItemBtn.x + 4f, crdItemBtn.y + 13f, (float)(int)((float)template2.CurIcon().width * 0.9f), (float)(int)((float)template2.CurIcon().height * 0.9f)), item: myUpgradeItems[num6]); LabelUtil.TextOut(crdRemain, myUpgradeItems[num6].GetRemainString(), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleRight); if (num6 == curItem) { TUpgrade tUpgrade = (TUpgrade)template2; curTier = tUpgrade.tier; GUI.Box(new Rect(crdItemBtn.x - 3f, crdItemBtn.y - 3f, crdItemBtn.width + 6f, crdItemBtn.height + 6f), string.Empty, "BtnItemF"); if (strErr == string.Empty) { strErr = CanUseUpgrader(tUpgrade); } } GUI.EndGroup(); num6++; num8++; } num7++; } GUI.EndScrollView(); } else { float x2 = crdUpgradeItemListBg.x + crdUpgradeItemListBg.width / 2f; float y2 = crdUpgradeItemListBg.y + crdUpgradeItemListBg.height / 2f; LabelUtil.TextOut(new Vector2(x2, y2), StringMgr.Instance.Get("NOTHING_UPGRADER"), "BigLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter); } Rect rc = new Rect(size.x - 50f, 10f, 34f, 34f); if (GlobalVars.Instance.MyButton(rc, string.Empty, "BtnClose") || GlobalVars.Instance.IsEscapePressed()) { bProgess = false; result = true; GlobalVars.Instance.StopSound(); GlobalVars.Instance.PlayOneShot(GlobalVars.Instance.sndButtonClick); AutoFunctionManager.Instance.DeleteAllAutoFunction(); } DoTooltip(new Vector2(base.rc.x, base.rc.y)); DoGagueEffect(); if (!ContextMenuManager.Instance.IsPopup) { WindowUtil.EatEvent(); } return(result); }
public void WiseSlot(Rect rcBox, Item item) { if (item == null) { GUI.Box(rcBox, string.Empty, "BoxInnerLine"); } else { string b = item.Seq.ToString() + "a"; GUI.Box(rcBox, new GUIContent(string.Empty, b), "BoxInnerLine"); GUI.BeginGroup(rcBox); TItem tItem = TItemManager.Instance.Get <TItem>(item.Code); if (tooltip.ItemSeq == b) { if (rcBox.x < 400f) { ltTooltip = new Vector2(rcBox.x + rcBox.width + 5f, rcBox.y); } else { ltTooltip = new Vector2(rcBox.x - tooltip.size.x - 5f, rcBox.y); } } Rect crdIcon = new Rect(crdItemBtn.x + 20f, crdItemBtn.y + 16f, (float)(int)((double)tItem.CurIcon().width * 0.65), (float)(int)((double)tItem.CurIcon().height * 0.65)); DrawItemIcon(item, crdIcon); if (item.IsUpgradedItem()) { if (item.CanUpgradeAble()) { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + 110f, crdItemBtn.y + 60f, 14f, 14f), GlobalVars.Instance.iconUpgrade, ScaleMode.ScaleToFit); } else { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + 110f, crdItemBtn.y + 60f, 16f, 16f), GlobalVars.Instance.iconUpgradeMax, ScaleMode.ScaleToFit); } } if (item.IsPCBang) { TextureUtil.DrawTexture(new Rect(crdItemBtn.x + 2f, crdItemBtn.y + 50f, 24f, 24f), GlobalVars.Instance.iconPCBang, ScaleMode.ScaleToFit); } Color color = GUI.color; GUI.color = GlobalVars.Instance.txtMainColor; GUI.Label(crdItemBtn, tItem.Name, "MiniLabel"); GUI.color = color; LabelUtil.TextOut(crdRemainWise, item.GetRemainString(), "MiniLabel", Color.white, new Color(0f, 0f, 0f, 0f), TextAnchor.MiddleRight); GUI.EndGroup(); } }