Ejemplo n.º 1
0
    // Token: 0x06002AF7 RID: 10999 RVA: 0x0009F830 File Offset: 0x0009DA30
    public int AddItemsOfCategory(global::ItemDataBlock.ItemCategory category, List <global::BlueprintDataBlock> checkList, int yPos)
    {
        if (!this.AnyOfCategoryInList(category, checkList))
        {
            return(yPos);
        }
        GameObject gameObject = global::NGUITools.AddChild(base.gameObject, this.CategoryHeaderPrefab);

        gameObject.transform.localPosition = new Vector3(0f, (float)yPos, -1f);
        gameObject.GetComponentInChildren <global::UILabel>().text = category.ToString();
        yPos -= 16;
        foreach (global::BlueprintDataBlock blueprintDataBlock in checkList)
        {
            if (blueprintDataBlock.resultItem.category == category)
            {
                GameObject gameObject2 = global::NGUITools.AddChild(base.gameObject, this.ItemPlaquePrefab);
                gameObject2.GetComponentInChildren <global::UILabel>().text = blueprintDataBlock.resultItem.name;
                gameObject2.transform.localPosition = new Vector3(10f, (float)yPos, -1f);
                global::UIEventListener uieventListener  = global::UIEventListener.Get(gameObject2);
                global::UIEventListener uieventListener2 = uieventListener;
                uieventListener2.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener2.onClick, new global::UIEventListener.VoidDelegate(this.craftWindow.ItemClicked));
                gameObject2.GetComponent <global::RPOSCraftItemEntry>().actualItemDataBlock = blueprintDataBlock.resultItem;
                gameObject2.GetComponent <global::RPOSCraftItemEntry>().blueprint           = blueprintDataBlock;
                gameObject2.GetComponent <global::RPOSCraftItemEntry>().craftWindow         = this.craftWindow;
                gameObject2.GetComponent <global::RPOSCraftItemEntry>().SetSelected(false);
                yPos -= 16;
            }
        }
        return(yPos);
    }
    // Token: 0x060049D2 RID: 18898 RVA: 0x0011BAEC File Offset: 0x00119CEC
    private void OnEnable()
    {
        string @string = PlayerPrefs.GetString(this.key);

        if (!string.IsNullOrEmpty(@string))
        {
            global::UICheckbox component = base.GetComponent <global::UICheckbox>();
            if (component != null)
            {
                component.isChecked = (@string == "true");
            }
            else
            {
                global::UICheckbox[] componentsInChildren = base.GetComponentsInChildren <global::UICheckbox>();
                int i   = 0;
                int num = componentsInChildren.Length;
                while (i < num)
                {
                    global::UICheckbox      uicheckbox      = componentsInChildren[i];
                    global::UIEventListener uieventListener = global::UIEventListener.Get(uicheckbox.gameObject);
                    uieventListener.onClick = (global::UIEventListener.VoidDelegate)Delegate.Remove(uieventListener.onClick, new global::UIEventListener.VoidDelegate(this.Save));
                    uicheckbox.isChecked    = (uicheckbox.name == @string);
                    Debug.Log(@string);
                    global::UIEventListener uieventListener2 = global::UIEventListener.Get(uicheckbox.gameObject);
                    uieventListener2.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener2.onClick, new global::UIEventListener.VoidDelegate(this.Save));
                    i++;
                }
            }
        }
    }
Ejemplo n.º 3
0
    // Token: 0x06002A5E RID: 10846 RVA: 0x0009D7A0 File Offset: 0x0009B9A0
    protected override void WindowAwake()
    {
        base.WindowAwake();
        global::UIEventListener uieventListener  = global::UIEventListener.Get(this.repairButton.gameObject);
        global::UIEventListener uieventListener2 = uieventListener;

        uieventListener2.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener2.onClick, new global::UIEventListener.VoidDelegate(this.RepairButtonClicked));
        this.ClearRepairItem();
    }
    // Token: 0x06004AD4 RID: 19156 RVA: 0x00121AC0 File Offset: 0x0011FCC0
    public static global::UIEventListener Get(GameObject go)
    {
        global::UIEventListener uieventListener = go.GetComponent <global::UIEventListener>();

        if (uieventListener == null)
        {
            uieventListener = go.AddComponent <global::UIEventListener>();
        }
        return(uieventListener);
    }
Ejemplo n.º 5
0
 // Token: 0x06002A8E RID: 10894 RVA: 0x0009E79C File Offset: 0x0009C99C
 internal void RemoveBumper(global::RPOSBumper.Instance inst)
 {
     if (this.bumpers != null && this.bumpers.Remove(inst))
     {
         global::UIEventListener listener = inst.listener;
         if (listener)
         {
             global::UIEventListener uieventListener = listener;
             uieventListener.onClick = (global::UIEventListener.VoidDelegate)Delegate.Remove(uieventListener.onClick, this.buttonCallback);
         }
     }
 }
Ejemplo n.º 6
0
 // Token: 0x06002A7F RID: 10879 RVA: 0x0009E00C File Offset: 0x0009C20C
 private void _EnsureDestroy()
 {
     if (this._awake)
     {
         if (this._lock_destroy)
         {
             Debug.LogWarning("Something tried to destroy while this window was destroying", this);
         }
         else
         {
             try
             {
                 this._lock_destroy = true;
                 if (this.closeButtonListener)
                 {
                     global::UIEventListener uieventListener = this.closeButtonListener;
                     uieventListener.onClick = (global::UIEventListener.VoidDelegate)Delegate.Remove(uieventListener.onClick, this.buttonCallback);
                 }
                 if (!this._closed)
                 {
                     this._showWithRPOS    = false;
                     this._showWithoutRPOS = false;
                     this.CheckDisplay();
                     if (this._opened && !this._closed)
                     {
                         this.WindowClose();
                     }
                 }
                 this.WindowDestroy();
             }
             catch (Exception arg)
             {
                 Debug.LogError(string.Format("A exception was thrown during window destroy ({0}, title={1}) and potentially screwed up stuff, exception is below\r\n{2}", this, this.TitleText, arg), this);
             }
             finally
             {
                 this._destroyed    = true;
                 this._lock_destroy = false;
                 global::RPOS.UnregisterWindow(this);
             }
         }
     }
     else if (this._lock_awake)
     {
         Debug.LogWarning("This window was awakening.. the call to destroy will happen when its done. Look at call stack. Avoid this.", this);
         this._destroyAfterAwake = true;
     }
     else if (!this._lock_destroy)
     {
         this._lock_destroy = true;
         Debug.LogWarning("This window is being destroyed, and has never got it's Awake.", this);
     }
 }
Ejemplo n.º 7
0
    // Token: 0x06002AE7 RID: 10983 RVA: 0x0009F3E8 File Offset: 0x0009D5E8
    protected override void WindowAwake()
    {
        base.WindowAwake();
        global::UIEventListener uieventListener  = global::UIEventListener.Get(this.actionButton.gameObject);
        global::UIEventListener uieventListener2 = uieventListener;

        uieventListener2.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener2.onClick, new global::UIEventListener.VoidDelegate(this.ActionButtonClicked));
        global::UIEventListener uieventListener3 = global::UIEventListener.Get(this.takeAllButton.gameObject);
        global::UIEventListener uieventListener4 = uieventListener3;

        uieventListener4.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener4.onClick, new global::UIEventListener.VoidDelegate(this.TakeAllButtonClicked));
    }
Ejemplo n.º 8
0
 // Token: 0x060049F8 RID: 18936 RVA: 0x0011C7E8 File Offset: 0x0011A9E8
 private void Start()
 {
     this.Init();
     if (Application.isPlaying && this.thumb != null && global::NGUITools.HasMeansOfClicking(this.thumb))
     {
         global::UIEventListener uieventListener  = global::UIEventListener.Get(this.thumb.gameObject);
         global::UIEventListener uieventListener2 = uieventListener;
         uieventListener2.onPress = (global::UIEventListener.BoolDelegate)Delegate.Combine(uieventListener2.onPress, new global::UIEventListener.BoolDelegate(this.OnPressThumb));
         global::UIEventListener uieventListener3 = uieventListener;
         uieventListener3.onDrag = (global::UIEventListener.VectorDelegate)Delegate.Combine(uieventListener3.onDrag, new global::UIEventListener.VectorDelegate(this.OnDragThumb));
     }
     this.Set(this.rawValue, true);
 }
 // Token: 0x06002A52 RID: 10834 RVA: 0x0009D498 File Offset: 0x0009B698
 protected override void WindowAwake()
 {
     this.autoResetScrolling = false;
     base.WindowAwake();
     if (!this.initalized && this.myLootable)
     {
         this.Initialize();
     }
     if (this.TakeAllButton)
     {
         global::UIEventListener uieventListener  = global::UIEventListener.Get(this.TakeAllButton.gameObject);
         global::UIEventListener uieventListener2 = uieventListener;
         uieventListener2.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener2.onClick, new global::UIEventListener.VoidDelegate(this.TakeAllButtonClicked));
     }
 }
    // Token: 0x06002A4A RID: 10826 RVA: 0x0009D0E8 File Offset: 0x0009B2E8
    public void AddRightClickEntry(string entry)
    {
        GameObject gameObject = global::NGUITools.AddChild(base.gameObject, this._buttonPrefab);

        gameObject.GetComponentInChildren <global::UILabel>().text = entry;
        global::UIEventListener uieventListener  = global::UIEventListener.Get(gameObject);
        global::UIEventListener uieventListener2 = uieventListener;

        uieventListener2.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener2.onClick, new global::UIEventListener.VoidDelegate(this.EntryClicked));
        gameObject.name          = entry;
        Vector3 localPosition = gameObject.transform.localPosition;

        localPosition.y = this.lastHeight;
        gameObject.transform.localPosition = localPosition;
        this.lastHeight -= gameObject.GetComponentInChildren <global::UISlicedSprite>().transform.localScale.y;
    }
Ejemplo n.º 11
0
    // Token: 0x06002A8D RID: 10893 RVA: 0x0009E72C File Offset: 0x0009C92C
    internal void AddBumper(global::RPOSBumper.Instance inst)
    {
        inst.label.text = this.title;
        global::UIEventListener listener = inst.listener;

        if (listener)
        {
            global::UIEventListener uieventListener = listener;
            uieventListener.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener.onClick, this.buttonCallback);
            if (this.bumpers == null)
            {
                this.bumpers = new List <global::RPOSBumper.Instance>();
            }
            this.bumpers.Add(inst);
        }
    }
    // Token: 0x06002A07 RID: 10759 RVA: 0x0009B9A8 File Offset: 0x00099BA8
    public new void Awake()
    {
        this.ShowCraftingOptions(false);
        global::UIEventListener uieventListener  = global::UIEventListener.Get(this.craftButton.gameObject);
        global::UIEventListener uieventListener2 = uieventListener;

        uieventListener2.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener2.onClick, new global::UIEventListener.VoidDelegate(this.CraftButtonClicked));
        global::UIEventListener uieventListener3 = global::UIEventListener.Get(this.plusButton.gameObject);
        global::UIEventListener uieventListener4 = uieventListener3;

        uieventListener4.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener4.onClick, new global::UIEventListener.VoidDelegate(this.PlusButtonClicked));
        global::UIEventListener uieventListener5 = global::UIEventListener.Get(this.minusButton.gameObject);
        global::UIEventListener uieventListener6 = uieventListener5;

        uieventListener6.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener6.onClick, new global::UIEventListener.VoidDelegate(this.MinusButtonClicked));
        this.amountInput.text    = "1";
    }
Ejemplo n.º 13
0
    // Token: 0x060049C7 RID: 18887 RVA: 0x0011B0BC File Offset: 0x001192BC
    private void Select(global::UILabel lbl, bool instant)
    {
        this.Highlight(lbl, instant);
        global::UIEventListener component = lbl.gameObject.GetComponent <global::UIEventListener>();

        this.selection = (component.parameter as string);
        global::UIButtonSound[] components = base.GetComponents <global::UIButtonSound>();
        int i   = 0;
        int num = components.Length;

        while (i < num)
        {
            global::UIButtonSound uibuttonSound = components[i];
            if (uibuttonSound.trigger == global::UIButtonSound.Trigger.OnClick)
            {
                global::NGUITools.PlaySound(uibuttonSound.audioClip, uibuttonSound.volume, 1f);
            }
            i++;
        }
    }
 // Token: 0x060049EC RID: 18924 RVA: 0x0011C27C File Offset: 0x0011A47C
 private void Start()
 {
     if (this.background != null && global::NGUITools.HasMeansOfClicking(this.background))
     {
         global::UIEventListener uieventListener  = global::UIEventListener.Get(this.background.gameObject);
         global::UIEventListener uieventListener2 = uieventListener;
         uieventListener2.onPress = (global::UIEventListener.BoolDelegate)Delegate.Combine(uieventListener2.onPress, new global::UIEventListener.BoolDelegate(this.OnPressBackground));
         global::UIEventListener uieventListener3 = uieventListener;
         uieventListener3.onDrag = (global::UIEventListener.VectorDelegate)Delegate.Combine(uieventListener3.onDrag, new global::UIEventListener.VectorDelegate(this.OnDragBackground));
     }
     if (this.foreground != null && global::NGUITools.HasMeansOfClicking(this.foreground))
     {
         global::UIEventListener uieventListener4 = global::UIEventListener.Get(this.foreground.gameObject);
         global::UIEventListener uieventListener5 = uieventListener4;
         uieventListener5.onPress = (global::UIEventListener.BoolDelegate)Delegate.Combine(uieventListener5.onPress, new global::UIEventListener.BoolDelegate(this.OnPressForeground));
         global::UIEventListener uieventListener6 = uieventListener4;
         uieventListener6.onDrag = (global::UIEventListener.VectorDelegate)Delegate.Combine(uieventListener6.onDrag, new global::UIEventListener.VectorDelegate(this.OnDragForeground));
     }
     this.ForceUpdate();
 }
Ejemplo n.º 15
0
 // Token: 0x060049CF RID: 18895 RVA: 0x0011B478 File Offset: 0x00119678
 private void OnClick()
 {
     if (this.mChild == null && this.atlas != null && this.font != null && this.items.Count > 1)
     {
         this.mLabelList.Clear();
         this.handleEvents = true;
         if (this.mPanel == null)
         {
             this.mPanel = global::UIPanel.Find(base.transform, true);
         }
         Transform      transform = base.transform;
         global::AABBox aabbox    = global::NGUIMath.CalculateRelativeWidgetBounds(transform.parent, transform);
         this.mChild       = new GameObject("Drop-down List");
         this.mChild.layer = base.gameObject.layer;
         Transform transform2 = this.mChild.transform;
         transform2.parent        = transform.parent;
         transform2.localPosition = aabbox.min;
         transform2.localRotation = Quaternion.identity;
         transform2.localScale    = Vector3.one;
         this.mBackground         = global::NGUITools.AddSprite(this.mChild, this.atlas, this.backgroundSprite);
         this.mBackground.pivot   = global::UIWidget.Pivot.TopLeft;
         this.mBackground.depth   = global::NGUITools.CalculateNextDepth(this.mPanel.gameObject);
         this.mBackground.color   = this.backgroundColor;
         Vector4 border = this.mBackground.border;
         this.mBgBorder = border.y;
         this.mBackground.cachedTransform.localPosition = new Vector3(0f, border.y, 0f);
         this.mHighlight       = global::NGUITools.AddSprite(this.mChild, this.atlas, this.highlightSprite);
         this.mHighlight.pivot = global::UIWidget.Pivot.TopLeft;
         this.mHighlight.color = this.highlightColor;
         global::UIAtlas.Sprite sprite = this.mHighlight.sprite;
         float num  = sprite.inner.yMin - sprite.outer.yMin;
         float num2 = (float)this.font.size * this.textScale;
         float num3 = 0f;
         float num4 = -this.padding.y;
         List <global::UILabel> list = new List <global::UILabel>();
         int i     = 0;
         int count = this.items.Count;
         while (i < count)
         {
             string          text    = this.items[i];
             global::UILabel uilabel = global::NGUITools.AddWidget <global::UILabel>(this.mChild);
             uilabel.pivot = global::UIWidget.Pivot.TopLeft;
             uilabel.font  = this.font;
             uilabel.text  = ((!this.isLocalized || !(global::Localization.instance != null)) ? text : global::Localization.instance.Get(text));
             uilabel.color = this.textColor;
             uilabel.cachedTransform.localPosition = new Vector3(border.x, num4, 0f);
             uilabel.MakePixelPerfect();
             if (this.textScale != 1f)
             {
                 Vector3 localScale = uilabel.cachedTransform.localScale;
                 uilabel.cachedTransform.localScale = localScale * this.textScale;
             }
             list.Add(uilabel);
             num4 -= num2;
             num4 -= this.padding.y;
             num3  = Mathf.Max(num3, uilabel.relativeSize.x * num2);
             global::UIEventListener uieventListener = global::UIEventListener.Get(uilabel.gameObject);
             uieventListener.onHover   = new global::UIEventListener.BoolDelegate(this.OnItemHover);
             uieventListener.onPress   = new global::UIEventListener.BoolDelegate(this.OnItemPress);
             uieventListener.parameter = text;
             if (this.mSelectedItem == text)
             {
                 this.Highlight(uilabel, true);
             }
             this.mLabelList.Add(uilabel);
             i++;
         }
         num3 = Mathf.Max(num3, aabbox.size.x - border.x * 2f);
         Vector3 center;
         center..ctor(num3 * 0.5f / num2, -0.5f, 0f);
         Vector3 size;
         size..ctor(num3 / num2, (num2 + this.padding.y) / num2, 1f);
         int j      = 0;
         int count2 = list.Count;
         while (j < count2)
         {
             global::UILabel   uilabel2  = list[j];
             global::UIHotSpot uihotSpot = global::NGUITools.AddWidgetHotSpot(uilabel2.gameObject);
             center.z         = uihotSpot.center.z;
             uihotSpot.center = center;
             uihotSpot.size   = size;
             j++;
         }
         num3 += border.x * 2f;
         num4 -= border.y;
         this.mBackground.cachedTransform.localScale = new Vector3(num3, -num4 + border.y, 1f);
         this.mHighlight.cachedTransform.localScale  = new Vector3(num3 - border.x * 2f + (sprite.inner.xMin - sprite.outer.xMin) * 2f, num2 + num * 2f, 1f);
         bool flag = this.position == global::UIPopupList.Position.Above;
         if (this.position == global::UIPopupList.Position.Auto)
         {
             global::UICamera uicamera = global::UICamera.FindCameraForLayer(base.gameObject.layer);
             if (uicamera != null)
             {
                 flag = (uicamera.cachedCamera.WorldToViewportPoint(transform.position).y < 0.5f);
             }
         }
         if (this.isAnimated)
         {
             float bottom = num4 + num2;
             this.Animate(this.mHighlight, flag, bottom);
             int k      = 0;
             int count3 = list.Count;
             while (k < count3)
             {
                 this.Animate(list[k], flag, bottom);
                 k++;
             }
             this.AnimateColor(this.mBackground);
             this.AnimateScale(this.mBackground, flag, bottom);
         }
         if (flag)
         {
             transform2.localPosition = new Vector3(aabbox.min.x, aabbox.max.y - num4 - border.y, aabbox.min.z);
         }
     }
     else
     {
         this.OnSelect(false);
     }
 }
Ejemplo n.º 16
0
 // Token: 0x06002A7E RID: 10878 RVA: 0x0009DE38 File Offset: 0x0009C038
 private void _EnsureAwake()
 {
     if (!this._awake)
     {
         if (this._lock_awake)
         {
             Debug.LogWarning("Something tried to ensure this while it was being awoken in ensure awake", this);
             return;
         }
         if (this._destroyed)
         {
             Debug.LogWarning("This window was destroyed before it could be awoke", this);
         }
         else if (this._lock_destroy)
         {
             Debug.LogWarning("This window is in the process of being destroyed, please look at the call stack and avoid this", this);
         }
         else
         {
             try
             {
                 this._lock_awake   = true;
                 this._myPanel      = base.GetComponent <global::UIPanel>();
                 this.panelsEnabled = false;
                 if (this._closeButton)
                 {
                     this.closeButtonListener = global::UIEventListener.Get(this._closeButton.gameObject);
                     if (this.closeButtonListener)
                     {
                         global::UIEventListener uieventListener = this.closeButtonListener;
                         uieventListener.onClick = (global::UIEventListener.VoidDelegate)Delegate.Combine(uieventListener.onClick, this.buttonCallback);
                     }
                 }
                 this.WindowAwake();
             }
             catch (Exception arg)
             {
                 Debug.LogError(string.Format("A exception was thrown during window awake ({0}, title={1}) and has probably broken something, exception is below\r\n{2}", this, this.TitleText, arg), this);
             }
             finally
             {
                 this._awake      = true;
                 this._lock_awake = false;
                 if (this._destroyAfterAwake)
                 {
                     Debug.LogWarning("Because of something trying to destroy this while we were awaking, destroy will occur now", this);
                     try
                     {
                         this._lock_destroy = true;
                         this.WindowDestroy();
                     }
                     catch (Exception arg2)
                     {
                         Debug.LogError(string.Format("A exception was thrown during window destroy following awake. ({0}, title={1}) and potentially screwed up stuff, exception is below\r\n{2}", this, this.TitleText, arg2), this);
                     }
                     finally
                     {
                         this._destroyed    = true;
                         this._lock_destroy = false;
                     }
                 }
                 else
                 {
                     global::RPOS.RegisterWindow(this);
                 }
             }
         }
     }
 }