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();
        }
    }
 public override void Start()
 {
     size.x   = 275f;
     size.y   = 330f;
     itemCode = string.Empty;
     itemSeq  = string.Empty;
     item     = null;
     tItem    = null;
     good     = null;
     isShop   = false;
     property.Start();
     property.gauge      = gauge;
     property.gaugeFrame = gaugeFrame;
     property.gaugeTiers = gaugeTiers;
 }
    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);
    }