Esempio n. 1
0
 public string GetOptionStringByOption(int opt)
 {
     if (tItem == null)
     {
         return(string.Empty);
     }
     return(tItem.GetOptionStringByOption(opt));
 }
Esempio n. 2
0
    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);
    }