public void InitDialog(long _seq, int _index, string _code, int _amount, bool _wasKey, TcStatus _tcStatus)
    {
        TItem tItem = TItemManager.Instance.Get <TItem>(_code);

        if (tItem == null)
        {
            Debug.LogError("Fail to get TItem for " + _code);
        }
        else
        {
            seq      = _seq;
            index    = _index;
            code     = _code;
            amount   = _amount;
            wasKey   = _wasKey;
            tcStatus = _tcStatus;
            isDraw   = true;
            changeColor.Reset();
            itemScroll.scrollPoint = Vector2.zero;
            curSpeed   = startSpeed;
            isProgress = true;
            curIndex   = 0;
            InitItemList();
            GlobalVars.Instance.PlayOneShot(sndStart);
        }
    }
 public void InitDialog(TcStatus curStatus)
 {
     tcStatus         = curStatus;
     myToken.texImage = TokenManager.Instance.currentToken.mark;
     token.texImage   = TokenManager.Instance.currentToken.mark;
     title.SetText(tcStatus.GetTitle());
     if (tcStatus.CoinPrice == 0)
     {
         explain.textKey      = "GACHAPON_CMT02";
         coin.IsDraw          = false;
         coinCount.IsDraw     = false;
         coinButton.IsDraw    = false;
         coinHighlight.IsDraw = false;
     }
     else
     {
         explain.textKey      = "GACHAPON_CMT01";
         coin.IsDraw          = true;
         coinCount.IsDraw     = true;
         coinButton.IsDraw    = true;
         coinHighlight.IsDraw = true;
         coinCount.SetText(tcStatus.CoinPrice.ToString());
     }
     if (tcStatus.TokenPrice == 0)
     {
         token.IsDraw          = false;
         tokenCount.IsDraw     = false;
         tokenButton.IsDraw    = false;
         tokenHighlight.IsDraw = false;
     }
     else
     {
         token.IsDraw          = true;
         tokenCount.IsDraw     = true;
         tokenButton.IsDraw    = true;
         tokenHighlight.IsDraw = true;
         tokenCount.SetText(tcStatus.TokenPrice.ToString());
     }
     rouletteEffect.IsDraw = false;
 }
    private void DoTooltip()
    {
        Dialog top = DialogManager.Instance.GetTop();

        if (GUI.tooltip.Length > 0 && top != null && top.ID == DialogManager.DIALOG_INDEX.TCGATE)
        {
            if (lastTooltip != GUI.tooltip && !DialogManager.Instance.IsModal)
            {
                GlobalVars.Instance.PlaySoundMouseOver();
            }
            Vector2 zero = Vector2.zero;
            zero.Set(300f, 150f);
            Vector2 position = GlobalVars.Instance.ToGUIPoint(Event.current.mousePosition);
            if (position.x > size.x * 0.5f)
            {
                position.x -= zero.x;
            }
            if (position.y > size.y * 0.5f)
            {
                position.y = position.x - zero.y;
            }
            tooltip.position = position;
            tooltip.area     = zero;
            tooltip.style    = "LineWindow";
            tooltip.BeginGroup();
            TcStatus tcStatus = TreasureChestManager.Instance.Get(Convert.ToInt32(GUI.tooltip));
            tooltipName.SetText(tcStatus.GetTitle());
            tooltipCount.SetText(tcStatus.Cur.ToString());
            tooltipRare.SetText(tcStatus.GetKeyDescription());
            tooltipProbability.SetText(tcStatus.Chance.ToString("0.##") + " %");
            tooltipLabels.Draw();
            tooltipName.Draw();
            tooltipCount.Draw();
            tooltipRare.Draw();
            tooltipProbability.Draw();
            tooltip.EndGroup();
            lastTooltip = GUI.tooltip;
        }
    }
 public void InitDialog(TcStatus tcs, List <byte> board, List <int> wasKey)
 {
     areYouSure = null;
     curTicket  = -1;
     spPrize    = new Vector2(0f, 0f);
     tcStatus   = tcs;
     tcBoard    = new List <byte>();
     tcWasKey   = new List <int>();
     erasing    = new Dictionary <int, Erasing>();
     stroking   = new Dictionary <int, Stroking>();
     rareFx     = new Dictionary <int, RareStuff>();
     prizes     = new Stack <TcPrize>();
     flying     = new Dictionary <int, Flying>();
     for (int i = 0; i < board.Count; i++)
     {
         tcBoard.Add(board[i]);
     }
     for (int j = 0; j < wasKey.Count; j++)
     {
         tcWasKey.Add(wasKey[j]);
     }
     wasKey.Clear();
 }
    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);
    }