コード例 #1
0
    // Use this for initialization
    void Start()
    {
        this._panel     = GetComponent <dfPanel>();
        this._indicator = Indicator;
        try
        {
            this._removeButton = transform.Find("Remove").GetComponent <dfButton>();
            if (RemoveRemove)
            {
                this._removeButton.Hide();
            }
            _removeButton.Click += RemoveButton_Click;
        }
        catch (Exception)
        {
        }

        try
        {
            this._indicator = transform.Find("Indicator").GetComponent <dfSprite>();
        }
        catch (Exception)
        {
        }
        this._label = transform.Find("Label").GetComponent <dfLabel>();
        this.name   = gameObject.name;

        color = _panel.BackgroundColor;
        _panel.BackgroundColor = grey;

        // print("Init");
        StartCoroutine(Initialize());
    }
コード例 #2
0
ファイル: ChatUI.cs プロジェクト: sknchan/LegacyRust
    public void ReLayout()
    {
        this.chatContainer.RelativePosition = new Vector2(0f, 0f);
        dfPanel[] componentsInChildren = this.chatContainer.GetComponentsInChildren <dfPanel>();
        float     height = 0f;

        dfPanel[] dfPanelArray = componentsInChildren;
        for (int i = 0; i < (int)dfPanelArray.Length; i++)
        {
            dfPanel _dfPanel = dfPanelArray[i];
            if (_dfPanel.gameObject != this.chatContainer.gameObject)
            {
                height = height + _dfPanel.Height;
            }
        }
        Vector2 vector2 = new Vector2(0f, this.chatContainer.Height - height);

        dfPanel[] dfPanelArray1 = componentsInChildren;
        for (int j = 0; j < (int)dfPanelArray1.Length; j++)
        {
            dfPanel _dfPanel1 = dfPanelArray1[j];
            if (_dfPanel1.gameObject != this.chatContainer.gameObject)
            {
                _dfPanel1.RelativePosition = vector2;
                vector2.y = vector2.y + _dfPanel1.Height;
            }
        }
    }
コード例 #3
0
    void PerformSlotClick(int slot, dfPanel panel)
    {
        if (MyRobot != null)
        {
            activePanel.DeactivatePanel();
            MyRobot.SwitchBrain(slot);

            switch (slot)
            {
            case 1:
                activePanel = Slot1.GetComponent <BrainPanelState>();
                break;

            case 2:
                activePanel = Slot2.GetComponent <BrainPanelState>();
                break;

            case 3:
                activePanel = Slot3.GetComponent <BrainPanelState>();
                break;

            case 4:
                activePanel = Slot4.GetComponent <BrainPanelState>();
                break;
            }
            activePanel.ActivatePanel();
        }
    }
コード例 #4
0
    public void Setup(float fSeconds, string strText)
    {
        Vector2 vector3;
        Vector2 size      = base.transform.parent.GetComponent <dfPanel>().Size;
        dfPanel component = base.GetComponent <dfPanel>();
        Vector2 vector2   = this.labelText.Font.MeasureText(strText, this.labelText.FontSize, this.labelText.FontStyle);

        this.labelText.Width = vector2.x + 16f;
        component.Width      = (this.labelText.RelativePosition.x + this.labelText.Width) + 8f;
        vector3 = new Vector2 {
            x = size.x + UnityEngine.Random.Range((float)-16f, (float)16f),
            y = (size.y * 0.7f) + UnityEngine.Random.Range((float)-16f, (float)16f),
            y = vector3.y + ((((((float)iYPos) / 6f) - 0.5f) * size.y) * 0.2f)
        };
        component.RelativePosition = (Vector3)vector3;
        iYPos++;
        if (iYPos > 5)
        {
            iYPos = 0;
        }
        Vector3 endValue = this.tweenOut.EndValue;

        endValue.y             = UnityEngine.Random.Range((float)-100f, (float)100f);
        this.tweenOut.EndValue = endValue;
        component.BringToFront();
        this.labelText.Text = strText;
        base.Invoke("PlayOut", fSeconds);
    }
コード例 #5
0
ファイル: PopupInventory.cs プロジェクト: sknchan/LegacyRust
    public void Setup(float fSeconds, string strText)
    {
        Vector2 size      = base.transform.parent.GetComponent <dfPanel>().Size;
        dfPanel component = base.GetComponent <dfPanel>();
        Vector2 vector2   = this.labelText.Font.MeasureText(strText, this.labelText.FontSize, this.labelText.FontStyle);

        this.labelText.Width = vector2.x + 16f;
        Vector3 relativePosition = this.labelText.RelativePosition;

        component.Width = relativePosition.x + this.labelText.Width + 8f;
        Vector2 vector21 = new Vector2()
        {
            x = size.x + UnityEngine.Random.Range(-16f, 16f),
            y = size.y * 0.7f + UnityEngine.Random.Range(-16f, 16f)
        };

        vector21.y = vector21.y + ((float)PopupInventory.iYPos / 6f - 0.5f) * size.y * 0.2f;
        component.RelativePosition = vector21;
        PopupInventory.iYPos       = PopupInventory.iYPos + 1;
        if (PopupInventory.iYPos > 5)
        {
            PopupInventory.iYPos = 0;
        }
        Vector3 endValue = this.tweenOut.EndValue;

        endValue.y             = UnityEngine.Random.Range(-100f, 100f);
        this.tweenOut.EndValue = endValue;
        component.BringToFront();
        this.labelText.Text = strText;
        base.Invoke("PlayOut", fSeconds);
    }
コード例 #6
0
ファイル: UserPanel.cs プロジェクト: richardlalancette/Thesis
    void GenerateList(string filter)
    {
        var children = new List <GameObject>();

        foreach (Transform child in PlayerPanel.transform)
        {
            children.Add(child.gameObject);
        }
        children.ForEach(child => Destroy(child));

        PlayerPanel.Enable();

        IEnumerable <Player> filtered = users.Where(t => t.Username.ToLower().Contains(filter.ToLower()))
                                        .OrderByDescending(t => pinnedPlayers.Any(u => u.ObjectId.Equals(t.ObjectId))).ThenBy(t => t.Username);

        foreach (Player player in filtered)
        {
            // GameObject ListItem = Instantiate(Resources.Load("List Item")) as GameObject;
            dfPanel listItem = PlayerPanel.AddPrefab(ListItem) as dfPanel; // as UserListItem;
            listItem.Width = PlayerPanel.Width - PlayerPanel.FlowPadding.left - PlayerPanel.FlowPadding.right;

            listItem.Click += new MouseEventHandler(listItem_Click);

            ListItemExtras extras = listItem.GetComponent <ListItemExtras>();
            extras.Player = player;


            dfLabel username = listItem.Find("Username Label").GetComponent <dfLabel>();
            username.Text          = player.Username;
            username.DisabledColor = new Color32(100, 100, 100, 255);

            dfSprite onlineSprite = listItem.Find("Online Sprite").GetComponent <dfSprite>();
            if (player.IsOnline)
            {
                onlineSprite.SpriteName = "OUYA_O 24px";
            }
            else
            {
                onlineSprite.SpriteName = "OUYA_A 24px";
            }

            dfButton actionButton = listItem.Find("Action Button").GetComponent <dfButton>();

            bool f = pinnedPlayers.Any(t => t.ObjectId.Equals(player.ObjectId));

            if (f)
            {
                actionButton.Text = "Unpin";
                //  listItem.BackgroundColor = new Color32(200, 255, 200, 255);
                listItem.BackgroundColor = new Color32(255, 255, 255, 255);

                actionButton.Click += new MouseEventHandler(actionButtonUnpin_Click);
            }
            else
            {
                actionButton.Text   = "Pin";
                actionButton.Click += new MouseEventHandler(actionButtonPin_Click);
            }
        }
    }
コード例 #7
0
ファイル: GameStart.cs プロジェクト: imdigitaljim/HackGT2014
 // Use this for initialization
 void Start()
 {
     combat = false;
     beginRound = 3;
     start = GameObject.Find("StartPanel").GetComponent<dfPanel>();
     startTxt = gameObject.GetComponent<dfLabel>();
 }
コード例 #8
0
 public void OnDisable()
 {
     if (panel != null)
     {
         panel.SizeChanged -= OnSizeChanged;
         panel              = null;
     }
 }
コード例 #9
0
    void Awake()
    {
        mPanel         = gameObject.GetComponent <dfPanel>();
        mLabel         = gameObject.GetComponentInChildren <dfLabel>();
        mTextBox       = gameObject.GetComponentInChildren <dfTextbox>();
        mPanel.enabled = false;

        DontDestroyOnLoad(gameObject);
    }
コード例 #10
0
    void Awake()
    {
        mPanel = gameObject.GetComponent<dfPanel>();
        mLabel = gameObject.GetComponentInChildren<dfLabel>();
        mTextBox = gameObject.GetComponentInChildren<dfTextbox>();
        mPanel.enabled = false;

        DontDestroyOnLoad (gameObject);
    }
コード例 #11
0
 void OnMouseEnter()
 {
     mouseOnObject = true;
     if (healthBar != null)
     {
         dfPanel dfp = healthBar.GetComponent <dfPanel> ();
         dfp.IsVisible = true;
     }
 }
コード例 #12
0
    // Use this for initialization
    void Start()
    {
        this.registerPanel = GetComponent <dfPanel>();

        BackButton.Click     += new MouseEventHandler(BackButton_Click);
        RegisterButton.Click += new MouseEventHandler(RegisterButton_Click);

        registerPanel.KeyDown += new KeyPressHandler(registerPanel_KeyDown);
    }
コード例 #13
0
    // Use this for initialization
    void Start()
    {
        _label  = transform.Find("Label").GetComponent <dfLabel>();
        _button = transform.Find("Button").GetComponent <dfButton>();
        _panel  = GetComponent <dfPanel>();

        _panel.Hide();
        _button.Click += button_Click;
    }
コード例 #14
0
    private void Refresh()
    {
        _container = GetComponent <dfPanel>();
        _sprite    = _container.Find("Icon") as dfSprite;
        _label     = _container.Find("Count") as dfLabel;

        _sprite.SpriteName = this.Icon;
        _label.Text        = (this.Count > 1) ? Count.ToString() : "";
    }
コード例 #15
0
 void Awake()
 {
     mScreenPanel = (dfPanel)GameObject.FindGameObjectWithTag("Screen").GetComponent(typeof(dfPanel));
     mSprite = GetComponent<dfTextureSprite>();
     if (mSprite == null) {
         mSprite = GetComponent<dfSlicedSprite>();
     }
     mProps = (dfScrollPanel)FindObjectOfType(typeof(dfScrollPanel));
     mRecordingProp = (RecordingProp)GetComponent (typeof(RecordingProp));
 }
コード例 #16
0
        internal static void PrepareCustomOptions()
        {
            CachedCentralPanel     = Patches.FullOptionsMenuController.Instance.TabGameplay.transform.parent.gameObject.GetComponent <dfPanel>();
            CachedOptionsAtlas     = Patches.FullOptionsMenuController.Instance.TabGameplay.Atlas;
            CachedOptionsScrollbar = Patches.FullOptionsMenuController.Instance.TabGameplay.VertScrollbar;
            CachedCrosshairSelectionDoerControl = Patches.PreOptionsMenuController.Instance.TabGameplaySelector.GetComponent <MenuCrosshairSelectionDoer>().controlToPlace;

            CachedOptionMenuEntry   = Patches.FullOptionsMenuController.Instance.TabGameplay.transform.GetChild(1).gameObject.GetComponent <dfPanel>();
            CachedCheckboxMenuEntry = Patches.FullOptionsMenuController.Instance.TabGameplay.transform.GetChild(0).gameObject.GetComponent <dfPanel>();
        }
コード例 #17
0
    // Use this for initialization
    void Start()
    {
        weaponSlot            = WeaponButton.GetComponent <SelectWeaponSlot>();
        Player.WeaponChanged += new global::Player.WeaponChangedEventHandler(Player_WeaponChanged);
        robotPanel            = transform.parent.GetComponent <RobotPanel>();
        panel      = this.GetComponent <dfPanel>();
        colorTween = this.GetComponent <dfTweenColor32>();

        Initialize();
    }
コード例 #18
0
    void Awake()
    {
        mPanel = gameObject.GetComponent<dfPanel>();
        mErrorText = gameObject.GetComponentsInChildren<dfLabel>()[1];
        mPanel.enabled = false;

        /**
         * Persist the LoadingPanel between scenes
         */
        DontDestroyOnLoad (gameObject);
    }
コード例 #19
0
 void OnMouseExit()
 {
     mouseOnObject = false;
     if (healthBar != null)
     {
         dfPanel dfp = healthBar.GetComponent <dfPanel> ();
         dfp.IsVisible = false;
         dfLabel minus = healthBar.GetComponentInChildren <dfLabel> ();
         minus.IsVisible = false;
     }
 }
コード例 #20
0
ファイル: MainMenu.cs プロジェクト: salvadj1/RustSource
 private void HideAllBut(dfPanel but)
 {
     if ((this.screenServers != null) && (this.screenServers != but))
     {
         this.screenServers.Hide();
     }
     if ((this.screenOptions != null) && (this.screenOptions != but))
     {
         this.screenOptions.Hide();
     }
 }
コード例 #21
0
    void Awake()
    {
        mPanel         = (dfPanel)gameObject.GetComponent(typeof(dfPanel));
        mAlertText     = (dfLabel)gameObject.GetComponentInChildren(typeof(dfLabel));
        mPanel.enabled = false;

        /**
         * Persist the LoadingPanel between scenes
         */
        DontDestroyOnLoad(gameObject);
    }
コード例 #22
0
    void Awake()
    {
        mPanel         = gameObject.GetComponent <dfPanel>();
        mErrorText     = gameObject.GetComponentsInChildren <dfLabel>()[1];
        mPanel.enabled = false;

        /**
         * Persist the LoadingPanel between scenes
         */
        DontDestroyOnLoad(gameObject);
    }
コード例 #23
0
    void Awake()
    {
        mPanel = (dfPanel)gameObject.GetComponent (typeof(dfPanel));
        mAlertText = (dfLabel)gameObject.GetComponentInChildren (typeof(dfLabel));
        mPanel.enabled = false;

        /**
         * Persist the LoadingPanel between scenes
         */
        DontDestroyOnLoad (gameObject);
    }
コード例 #24
0
ファイル: MainMenu.cs プロジェクト: richardlalancette/Thesis
    // Use this for initialization
    void Start()
    {
        panel = this.GetComponent <dfPanel>();
        BootcampButton.Click  += new MouseEventHandler(BootcampButton_Click);
        ChampionsButton.Click += new MouseEventHandler(ChampionsButton_Click);
        LogoutButton.Click    += new MouseEventHandler(LogoutButton_Click);
        ExitButton.Click      += new MouseEventHandler(ExitButton_Click);

        ContinueButton.Click += new MouseEventHandler(ContinueButton_Click);
        BackButton.Click     += new MouseEventHandler(BackButton_Click);
    }
コード例 #25
0
    void slot1_DragEnter(dfControl control, dfDragEventArgs dragEvent)
    {
        dfPanel panel = control as dfPanel;

        print("Drag enter");
        if (draggedBrain != null)
        {
            panel.BackgroundColor = new Color32(255, 255, 255, 255);
            activeSlot            = panel;
        }
    }
コード例 #26
0
    bool hasDroppedFirst = false;     // This tracks if this is our first drag - if so we can do something special on first drop

    void Awake()
    {
        mScreenPanel = (dfPanel)GameObject.FindGameObjectWithTag("Screen").GetComponent(typeof(dfPanel));
        mSprite      = GetComponent <dfTextureSprite>();
        if (mSprite == null)
        {
            mSprite = GetComponent <dfSlicedSprite>();
        }
        mProps         = (dfScrollPanel)FindObjectOfType(typeof(dfScrollPanel));
        mRecordingProp = (RecordingProp)GetComponent(typeof(RecordingProp));
    }
コード例 #27
0
    public void OnEnable()
    {
        this.panel = GetComponent <dfPanel>();
        if (panel == null)
        {
            Debug.LogError("The " + this.GetType().Name + " component requires a dfPanel component.", gameObject);
            this.enabled = false;
            return;
        }

        panel.SizeChanged += OnSizeChanged;
    }
コード例 #28
0
    protected void BaseStart()
    {
        //this may eventually be extended by specific unit extensions
        use = new UnitStateExecutor(this);

        spriteRenderer = gameObject.GetComponent <SpriteRenderer> ();
        animator       = gameObject.GetComponent <Animator> ();
        audioSource    = gameObject.GetComponent <AudioSource> ();

        //add a health bar
        if (healthBarPrefab != null)
        {
            //healthBarPrefab.gameObject = gameObject;

            GameObject gui = GameObject.FindGameObjectWithTag("GuiManager");
            //GameObject healthBarPrefab = GameObject.FindGameObjectWithTag ("HealthBar");

            healthBar = (Transform)Instantiate(healthBarPrefab, transform.position, transform.rotation);
            if (healthBar != null)
            {
                healthBar.name   = "HealthBar";
                healthBar.parent = gui.transform;

                healthBar.GetComponent <dfFollowObject> ().mainCamera = Camera.main;
                healthBar.GetComponent <dfFollowObject> ().attach     = gameObject;
                healthBar.GetComponent <dfFollowObject> ().enabled    = true;

                healthBar.GetComponentInChildren <dfProgressBar> ().MaxValue = lifePoints;
                healthBar.GetComponentInChildren <dfProgressBar> ().Value    = lifePoints;

                dfPanel dfp = healthBar.GetComponent <dfPanel> ();
                dfp.IsVisible = false;
            }
            else
            {
                Debug.Log("could not instantiate");
            }
        }

        statesSupported = new List <int> (new int[] {
            StateIdle,
            StateSelected,
            StateAdvancing,
            StateMelee,
            StateDead
        });

        BattleSceneManager.s.units.Add(this);

        SetState(StateIdle);

        BattleSceneManager.s.OnUnitClick += OnUnitClick;
    }
コード例 #29
0
ファイル: iPanelUpdate.cs プロジェクト: isaveu/DawnOfAdam
    // Use this for initialization
    void Start()
    {
        player    = GameObject.Find("Player").GetComponent <PlayerInventory>();
        iPanel    = GetComponent <dfPanel>();
        selection = GameObject.Find("iSelector");
        selection.GetComponent <dfSprite>().enabled = false;
        iPanel.enabled = !iPanel.enabled;

        iList = GameObject.FindGameObjectsWithTag("iPanelItem");
        for (int i = 0; i < iList.Length; i++)
        {
            iList[i].GetComponent <dfSprite>().enabled = false;
        }
    }
コード例 #30
0
    // Use this for initialization
    void Start()
    {
        panel              = GetComponent <dfPanel>();
        CloseButton.Click += new MouseEventHandler(CloseButton_Click);
        NextButton.Click  += new MouseEventHandler(NextButton_Click);
        PrevButton.Click  += new MouseEventHandler(PrevButton_Click);

        UpdatePage();

        if (PlayerPrefs.GetInt(TUTORIAL_SEEN, 0) == 1)
        {
            panel.Hide();
        }
    }
コード例 #31
0
    // Use this for initialization
    void Start()
    {
        panel          = GetComponent <dfPanel>();
        infoLabel      = panel.transform.FindChild("Info Label").GetComponent <dfLabel>();
        infoLabel.Text = "Look here for tips and tricks!";

        focusAreas             = GameObject.Find("Focus Areas").GetComponent <dfPanel>();
        focusAreas.MouseHover += focusAreas_MouseHover;

        panel.MouseHover += panel_MouseHover;

        GameObject.Find("Target Behavior").GetComponent <dfPanel>().MouseHover += TipsBehaviour_MouseHover;
        GameObject.Find("Train Button").GetComponent <dfButton>().MouseHover   += TrainButton_MouseHover;
        GameObject.Find("Reset Button").GetComponent <dfButton>().MouseHover   += ResetButton_MouseHover;
    }
コード例 #32
0
    // Use this for initialization
    void Start()
    {
        panel               = this.GetComponent <dfPanel>();
        BackButton.Click   += new MouseEventHandler(BackButton_Click);
        DeleteButton.Click += new MouseEventHandler(DeleteButton_Click);
        TrainButton.Click  += new MouseEventHandler(TrainButton_Click);
        InfoButton.Click   += new MouseEventHandler(InfoButton_Click);
        Initialize();
        DisableLockedFocusAreas();

        if (Settings.Brain != null)
        {
            NameTextBox.Text = Settings.Brain.Name;
        }
    }
コード例 #33
0
    // Use this for initialization
    void Start()
    {
        dialogPanel = GetComponent <dfPanel>();
        if (DismissButton == null)
        {
        }
        DismissButton.Click += new MouseEventHandler(DismissButton_Click);

        if (CancelButton != null)
        {
            CancelButton.Click += new MouseEventHandler(CancelButton_Click);
        }

        dialogPanel.KeyDown += new KeyPressHandler(dialogPanel_KeyDown);
    }
コード例 #34
0
ファイル: dfCoverflow.cs プロジェクト: LeoNERDMaia/cavedumbat
    public void OnEnable()
    {
        container                 = GetComponent <dfPanel>();
        container.Pivot           = dfPivotPoint.MiddleCenter;
        container.ControlAdded   += container_ControlCollectionChanged;
        container.ControlRemoved += container_ControlCollectionChanged;

        controls = new dfList <dfControl>(container.Controls);

        if (rotationCurve.keys.Length == 0)
        {
            rotationCurve.AddKey(0, 0);
            rotationCurve.AddKey(1, 1);
        }
    }
コード例 #35
0
    void listItem_Click(dfControl control, dfMouseEventArgs mouseEvent)
    {
        if (currentlySelected != null)
        {
            currentlySelected.BackgroundColor = new Color32(255, 255, 255, 255);
            currentlySelected.Find("Selected Indicator").GetComponent <dfSprite>().Hide();
        }

        dfPanel  item = control as dfPanel;
        RoomData data = item.GetComponent <RoomData>();

        data.Selected        = true;
        item.BackgroundColor = new Color32(0, 0, 0, 255);
        currentlySelected    = item;
        currentlySelected.Find("Selected Indicator").GetComponent <dfSprite>().Show();
    }
コード例 #36
0
    // Called by Unity just before any of the Update methods is called the first time.
    public void Start()
    {
        // Store the singleton instance for reference in static functions
        _instance = this;

        // Obtain a reference to the control instances attached to this object
        _panel = GetComponent<dfPanel>();
        _name = _panel.Find<dfLabel>( "lblName" );
        _info = _panel.Find<dfLabel>( "lblInfo" );

        // We don't want the tooltip visible unless it is being used
        _panel.Hide();

        // We don't want the tooltip to intercept mouse messages
        _panel.IsInteractive = false;
        _panel.IsEnabled = false;
    }
コード例 #37
0
    void OnEnable()
    {
        Container = GetComponent<dfPanel>();
        if( Container == null )
        {
            this.enabled = false;
        }

        NameLabel = Container.Find<dfLabel>( "Name" );
        DescriptionLabel = Container.Find<dfLabel>( "Description" );
        ProgressLabel = Container.Find<dfLabel>( "ProgressLabel" );
        Icon = Container.Find<dfSprite>( "Icon" );
        ProgressBar = Container.Find<dfProgressBar>( "ProgressBar" );

        Container.BackgroundSprite = "frame-style6";
        NameLabel.BackgroundSprite = null;
        ProgressBar.Opacity = 0.5f;
    }
コード例 #38
0
ファイル: RGBSliders.cs プロジェクト: kvelury/apocalyptia
 public void Start()
 {
     this.container = GetComponent<dfPanel>();
 }
コード例 #39
0
 private void performLayout()
 {
     if (this.panel == null)
     {
         this.panel = base.GetComponent<dfPanel>();
     }
     Vector3 vector3 = new Vector3((float)this.borderPadding.left, (float)this.borderPadding.top);
     bool flag = true;
     float width = this.panel.Width - (float)this.borderPadding.right;
     float height = this.panel.Height - (float)this.borderPadding.bottom;
     int num = 0;
     IList<dfControl> controls = this.panel.Controls;
     int num1 = 0;
     while (num1 < controls.Count)
     {
         if (!flag)
         {
             if (this.flowDirection != dfControlOrientation.Horizontal)
             {
                 vector3.y = vector3.y + this.itemSpacing.y;
             }
             else
             {
                 vector3.x = vector3.x + this.itemSpacing.x;
             }
         }
         dfControl item = controls[num1];
         if (this.flowDirection == dfControlOrientation.Horizontal)
         {
             if (!flag && vector3.x + item.Width >= width)
             {
                 vector3.x = (float)this.borderPadding.left;
                 vector3.y = vector3.y + (float)num;
                 num = 0;
                 flag = true;
             }
         }
         else if (!flag && vector3.y + item.Height >= height)
         {
             vector3.y = (float)this.borderPadding.top;
             vector3.x = vector3.x + (float)num;
             num = 0;
             flag = true;
         }
         item.RelativePosition = vector3;
         if (this.flowDirection != dfControlOrientation.Horizontal)
         {
             vector3.y = vector3.y + item.Height;
             num = Mathf.Max(Mathf.CeilToInt(item.Width + this.itemSpacing.x), num);
         }
         else
         {
             vector3.x = vector3.x + item.Width;
             num = Mathf.Max(Mathf.CeilToInt(item.Height + this.itemSpacing.y), num);
         }
         item.IsVisible = this.canShowControlUnclipped(item);
         num1++;
         flag = false;
     }
 }
コード例 #40
0
 public void OnDisable()
 {
     if( panel != null )
     {
         panel.SizeChanged -= OnSizeChanged;
         panel = null;
     }
 }
コード例 #41
0
    public void OnEnable()
    {
        this.panel = GetComponent<dfPanel>();
        if( panel == null )
        {
            Debug.LogError( "The " + this.GetType().Name + " component requires a dfPanel component.", gameObject );
            this.enabled = false;
            return;
        }

        panel.SizeChanged += OnSizeChanged;
    }
コード例 #42
0
    public void PerformLayout()
    {
        if( panel == null )
        {
            this.panel = GetComponent<dfPanel>();
        }

        var position = new Vector3( borderPadding.left, borderPadding.top );

        var firstInLine = true;

        var maxX = ( flowDirection == dfControlOrientation.Horizontal && maxLayoutSize > 0 ) ? maxLayoutSize : panel.Width - borderPadding.right;
        var maxY = ( flowDirection == dfControlOrientation.Vertical && maxLayoutSize > 0 ) ? maxLayoutSize : panel.Height - borderPadding.bottom;

        var maxSize = 0;

        var controls = panel.Controls;
        for( int i = 0; i < controls.Count; i++, firstInLine = false )
        {

            var control = controls[ i ];
            if( !control.enabled || !control.gameObject.activeSelf || excludedControls.Contains( control ) )
                continue;

            if( !firstInLine )
            {
                if( flowDirection == dfControlOrientation.Horizontal )
                    position.x += itemSpacing.x;
                else
                    position.y += itemSpacing.y;
            }

            if( flowDirection == dfControlOrientation.Horizontal )
            {
                if( !firstInLine && position.x + control.Width > maxX + float.Epsilon )
                {

                    position.x = borderPadding.left;
                    position.y += maxSize;

                    maxSize = 0;
                    firstInLine = true;

                }
            }
            else
            {
                if( !firstInLine && position.y + control.Height > maxY + float.Epsilon )
                {

                    position.y = borderPadding.top;
                    position.x += maxSize;

                    maxSize = 0;
                    firstInLine = true;

                }
            }

            control.RelativePosition = position;

            if( flowDirection == dfControlOrientation.Horizontal )
            {
                position.x += control.Width;
                maxSize = Mathf.Max( Mathf.CeilToInt( control.Height + itemSpacing.y ), maxSize );
            }
            else
            {
                position.y += control.Height;
                maxSize = Mathf.Max( Mathf.CeilToInt( control.Width + itemSpacing.x ), maxSize );
            }

            control.IsVisible = canShowControlUnclipped( control );

        }
    }
コード例 #43
0
ファイル: PopupUI.cs プロジェクト: HexHash/LegacyRust
 private void Start()
 {
     PopupUI.singleton = this;
     this.panelLocal = base.GetComponent<dfPanel>();
 }
コード例 #44
0
ファイル: MainMenu.cs プロジェクト: HexHash/LegacyRust
 private void HideAllBut(dfPanel but)
 {
     if (this.screenServers && this.screenServers != but)
     {
         this.screenServers.Hide();
     }
     if (this.screenOptions && this.screenOptions != but)
     {
         this.screenOptions.Hide();
     }
 }
コード例 #45
0
 public void OnEnable()
 {
     this.panel = base.GetComponent<dfPanel>();
     this.panel.SizeChanged += new PropertyChangedEventHandler<Vector2>(this.OnSizeChanged);
 }
コード例 #46
0
    private void Refresh()
    {
        _container = GetComponent<dfPanel>();
        _sprite = _container.Find( "Icon" ) as dfSprite;
        _label = _container.Find( "Count" ) as dfLabel;

        _sprite.SpriteName = this.Icon;
        _label.Text = ( this.Count > 1 ) ? Count.ToString() : "";
    }
コード例 #47
0
ファイル: dfCoverflow.cs プロジェクト: kvelury/apocalyptia
    public void OnEnable()
    {
        container = GetComponent<dfPanel>();
        container.Pivot = dfPivotPoint.MiddleCenter;
        container.ControlAdded += container_ControlCollectionChanged;
        container.ControlRemoved += container_ControlCollectionChanged;

        controls = new dfList<dfControl>( container.Controls );

        if( rotationCurve.keys.Length == 0 )
        {
            rotationCurve.AddKey( 0, 0 );
            rotationCurve.AddKey( 1, 1 );
        }
    }