Beispiel #1
0
    public override void run(GameObject pScreen)
    {
        // First we destroy the object if it already exists
        foreach (PlayingProp p in pScreen.GetComponentsInChildren <PlayingProp>().Where(p => p.uID == uID))
        {
            GameObject.Destroy(p.gameObject);
        }

        GameObject g = (GameObject)GameObject.Instantiate(mPlayingDialoguePrefab, Vector3.zero, Quaternion.identity);

        g.transform.parent = pScreen.transform;

        dfSlicedSprite sprite = g.GetComponent <dfSlicedSprite>();

        sprite.SpriteName = mSpriteName;
        sprite.Size       = new Vector2(float.Parse(mSizeX), float.Parse(mSizeY));
        sprite.Position   = new Vector2(float.Parse(mNewX), float.Parse(mNewY));
        sprite.ZOrder     = int.Parse(mZOrder);

        PlayingProp r = g.GetComponent <PlayingProp>();

        r.uID = uID;

        dfLabel l = g.GetComponentInChildren <dfLabel>();

        l.Text      = mText;
        l.TextScale = float.Parse(mTextScale);

        sprite.enabled = true;
    }
    // Called by Unity just before any of the Update methods is called the first time.
    public void Start()
    {
        _sprite           = GetComponent <dfSprite>();
        _sprite.IsVisible = false;

        _label = _sprite.Find <dfLabel>("Count");
    }
Beispiel #3
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());
    }
    /**
     * Create an info box for another player
     */
    void CreatePlayerInfoBox(Player pPlayer)
    {
        GameObject playerInfo = (GameObject)Instantiate(mPlayerInfoPrefab, Vector3.zero, Quaternion.identity);

        playerInfo.transform.parent = mPlayersList.gameObject.transform;

        dfLabel nameLabel = (dfLabel)playerInfo.GetComponentsInChildren(typeof(dfLabel))[0];

        dfPropertyBinding.Bind(nameLabel.gameObject, pPlayer, "uName", nameLabel, "Text");

        dfLabel stationLabel = (dfLabel)playerInfo.GetComponentsInChildren(typeof(dfLabel))[1];

        dfPropertyBinding.Bind(stationLabel.gameObject, pPlayer, "uStationName", stationLabel, "Text");

        dfTextureSprite stationLogo = playerInfo.transform.FindChild("StationLogo").GetComponent <dfTextureSprite>();

        dfPropertyBinding.Bind(stationLogo.gameObject, pPlayer, "uStationLogo", stationLogo, "Texture");

        PlayerInfoBox p = (PlayerInfoBox)playerInfo.GetComponent(typeof(PlayerInfoBox));

        p.uID = pPlayer.uID;

        dfTextureSprite d = playerInfo.transform.FindChild("IsPlayerReady").GetComponent <dfTextureSprite>();

        dfPropertyBinding.Bind(d.gameObject, pPlayer, "uReadyTexture", d, "Texture");
    }
    // Called by Unity just before any of the Update methods is called the first time.
    public void Start()
    {
        _sprite = GetComponent<dfSprite>();
        _sprite.IsVisible = false;

        _label = _sprite.Find<dfLabel>( "Count" );
    }
Beispiel #6
0
 // Use this for initialization
 void Start()
 {
     combat = false;
     beginRound = 3;
     start = GameObject.Find("StartPanel").GetComponent<dfPanel>();
     startTxt = gameObject.GetComponent<dfLabel>();
 }
Beispiel #7
0
    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);
            }
        }
    }
        void Start()
        {
            string text = "HI IM LARRY";

            if (namesDB != null)
            {
                text = namesDB[UnityEngine.Random.Range(0, namesDB.Count)];
            }
            sprite = this.gameObject.GetComponent <tk2dSprite>();
            GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(BraveResources.Load("DamagePopupLabel", ".prefab"), GameUIRoot.Instance.transform);

            Vector3 worldPosition = this.transform.position;

            nameLabel = gameObject.GetComponent <dfLabel>();

            NamerModuleClassic.onNameSizeChanged      += this.OnNameSizeChanged;
            NamerModuleClassic.onOpacityAmountChanged += this.OnOpacityAmountChanged;

            if (UnityEngine.Random.value > 0.995f)
            {
                nameLabel.Glitchy = true;
            }
            nameLabel.gameObject.SetActive(true);
            nameLabel.Text               = text;
            nameLabel.Color              = Color.HSVToRGB(UnityEngine.Random.value, 1.0f, 1.0f);
            nameLabel.Opacity            = Larry.opacityAmount;
            nameLabel.transform.position = dfFollowObject.ConvertWorldSpaces(worldPosition, GameManager.Instance.MainCameraController.Camera, GameUIRoot.Instance.Manager.RenderCamera).WithZ(0f);
            nameLabel.transform.position = nameLabel.transform.position.QuantizeFloor(nameLabel.PixelsToUnits() / (Pixelator.Instance.ScaleTileScale / Pixelator.Instance.CurrentTileScale));
            nameLabel.TextScale          = Larry.nameSize;
            xOffSet = CalculateCenterXoffset(nameLabel);
        }
    public void ShowDialog(string text)
    {
        dfLabel label = panel.transform.FindChild("Text Label").GetComponent <dfLabel>();

        label.Text = text;
        panel.Show();
    }
    private void ShowFloatingText(float damage)
    {
        dfTweenVector3 tween = label.GetComponent <dfTweenVector3>();

        //Destroy(tween);
        tween.StartValue = GUI.WorldPointToGUI(gameObject.transform.position) + new Vector2(0, -50);;
        //print("Pos: " + label.transform.position);
        //dfFollowObject follow = label.GetComponent<dfFollowObject>();
        //follow.attach = gameObject;
        //follow.mainCamera = Camera.main;

        dfLabel glabel = GUI.AddPrefab(label) as dfLabel;

        glabel.RelativePosition = GUI.WorldPointToGUI(gameObject.transform.position) + new Vector2(0, -50);
        if (damage > 0)
        {
            glabel.Text        = string.Format("-{0:#.##}!", damage);
            glabel.BottomColor = new Color32(254, 0, 0, 254);
        }
        else if (damage < 0)
        {
            glabel.Text        = string.Format("+{0:#.##}!", damage);
            glabel.BottomColor = new Color32(0, 254, 0, 254);
        }
        else
        {
            glabel.Text        = "Hit!";
            glabel.BottomColor = new Color32(100, 100, 254, 254);
        }
    }
Beispiel #11
0
 public override void run(GameObject pScreen)
 {
     foreach (PlayingProp p in pScreen.GetComponentsInChildren <PlayingProp>().Where(p => p.uID == uID))
     {
         dfLabel l = p.GetComponentInChildren <dfLabel>();
         l.TextScale = float.Parse(mTextScale);
     }
 }
Beispiel #12
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;
    }
    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() : "";
    }
    void Awake()
    {
        mQuestionPanel      = FindObjectOfType <QuestionPanel>();
        mLabel              = GetComponentInChildren <dfLabel>();
        mDialogueSizeTester = FindObjectOfType <DialogueSizeTester>();

        mLabel.Text = "";
        ScaleText();
    }
    void Awake()
    {
        mPanel         = gameObject.GetComponent <dfPanel>();
        mLabel         = gameObject.GetComponentInChildren <dfLabel>();
        mTextBox       = gameObject.GetComponentInChildren <dfTextbox>();
        mPanel.enabled = false;

        DontDestroyOnLoad(gameObject);
    }
    void Awake()
    {
        mPanel = gameObject.GetComponent<dfPanel>();
        mLabel = gameObject.GetComponentInChildren<dfLabel>();
        mTextBox = gameObject.GetComponentInChildren<dfTextbox>();
        mPanel.enabled = false;

        DontDestroyOnLoad (gameObject);
    }
    public void UpdateGUIScores()
    {
        dfLabel rs = GameObject.FindGameObjectWithTag("RomanScore").GetComponent <dfLabel> ();

        rs.Text = I18n.T("ROMAN_SCORE_%%", GameManager.i.romanPoints);
        dfLabel gs = GameObject.FindGameObjectWithTag("GermanicScore").GetComponent <dfLabel> ();

        gs.Text = I18n.T("GERMANIC_SCORE_%%", GameManager.i.germanicPoints);
    }
        public new void OnEnteredRange(PlayerController interactor)
        {
            if (!this)
            {
                return;
            }
            SpriteOutlineManager.RemoveOutlineFromSprite(base.sprite, false);
            SpriteOutlineManager.AddOutlineToSprite(base.sprite, Color.white);
            Vector3            offset    = new Vector3(base.sprite.GetBounds().max.x + 0.1875f, base.sprite.GetBounds().min.y, 0f);
            EncounterTrackable component = this.item.GetComponent <EncounterTrackable>();
            string             arg       = (!(component != null)) ? this.item.DisplayName : component.journalData.GetPrimaryDisplayName(false);
            string             text      = this.ModifiedPrice.ToString();

            if (this.m_baseParentShop != null)
            {
                if (this.CurrencyType == CustomShopItemController.ShopCurrencyType.META_CURRENCY)
                {
                    text += "[sprite \"hbux_text_icon\"]";
                }
                else if (this.CurrencyType == CustomShopItemController.ShopCurrencyType.COINS)
                {
                    text += "[sprite \"ui_coin\"]";
                }
                else if (this.CurrencyType == CustomShopItemController.ShopCurrencyType.KEYS)
                {
                    text += "[sprite \"ui_key\"]";
                }
                else if (this.CurrencyType == CustomShopItemController.ShopCurrencyType.BLANKS)
                {
                    text += "[sprite \"ui_blank\"]";
                }
                else if (this.CurrencyType == CustomShopItemController.ShopCurrencyType.CUSTOM)
                {
                    text += "[sprite \"" + customPriceSprite + "\"]";
                }
                else
                {
                    text += "[sprite \"ui_coin\"]";
                }
            }
            string text2;

            if ((this.m_baseParentShop && (this.m_baseParentShop.IsCapableOfBeingStolenFrom) || interactor.IsCapableOfStealing) && this.m_baseParentShop.canBeRobbed)
            {
                text2 = string.Format("[color red]{0}: {1} {2}[/color]", arg, text, StringTableManager.GetString("#STEAL"));
            }
            else
            {
                text2 = string.Format("{0}: {1}", arg, text);
            }
            GameObject gameObject          = GameUIRoot.Instance.RegisterDefaultLabel(base.transform, offset, text2);
            dfLabel    componentInChildren = gameObject.GetComponentInChildren <dfLabel>();

            componentInChildren.ColorizeSymbols = false;
            componentInChildren.ProcessMarkup   = true;
        }
    public void Start()
    {
        // Obtain a reference to the dfLabel control that will
        // render the tooltip data
        this._tooltip = GetComponent <dfLabel>();

        // We don't want the tooltip to intercept mouse messages
        _tooltip.IsInteractive = false;
        _tooltip.IsEnabled     = false;
    }
    public void Start()
    {
        // Obtain a reference to the dfLabel control that will
        // render the tooltip data
        this._tooltip = GetComponent<dfLabel>();

        // We don't want the tooltip to intercept mouse messages
        _tooltip.IsInteractive = false;
        _tooltip.IsEnabled = false;
    }
 public void Display(string s)
 {
     if (tween != null)
     {
         tween.Play();
     }
     if (l == null)
         l = GetComponent<dfLabel>();
     l.Text = s;
 }
Beispiel #22
0
    private float timeleft; // Left time for current interval

    #endregion Fields

    #region Methods

    void Start()
    {
        label = GetComponent<dfLabel>();
        if( label == null )
        {
            Debug.LogError( "FPS Counter needs a Label component!" );
        }

        timeleft = updateInterval;
    }
Beispiel #23
0
    void Start()
    {
        info = GetComponent<dfLabel>();
        if( info == null )
        {
            this.enabled = false;
            throw new InvalidProgramException( "No Label component found" );
        }

        view = info.GetManager();
    }
 void OnMouseExit()
 {
     mouseOnObject = false;
     if (healthBar != null)
     {
         dfPanel dfp = healthBar.GetComponent <dfPanel> ();
         dfp.IsVisible = false;
         dfLabel minus = healthBar.GetComponentInChildren <dfLabel> ();
         minus.IsVisible = false;
     }
 }
Beispiel #25
0
    void Awake()
    {
        mPanel         = gameObject.GetComponent <dfPanel>();
        mErrorText     = gameObject.GetComponentsInChildren <dfLabel>()[1];
        mPanel.enabled = false;

        /**
         * Persist the LoadingPanel between scenes
         */
        DontDestroyOnLoad(gameObject);
    }
    void Start()
    {
        info = GetComponent <dfLabel>();
        if (info == null)
        {
            this.enabled = false;
            throw new Exception("No Label component found");
        }

        info.Text = "";
    }
Beispiel #27
0
 public static ISubscription bind(
     this IObservable <ValueWithStorage> subject, dfLabel control
     )
 {
     return(withTween(set => subject.subscribe(value => set(Go.to(
                                                                TF.a(
                                                                    () => ValueWithStorage.parse(control.Text).AsVector2(),
                                                                    v => control.Text = new ValueWithStorage(v).AsString()
                                                                    ), TWEEN_DURATION, tCfg.vector2Prop(TF.Prop, value.AsVector2())
                                                                )))));
 }
    void Start()
    {
        info = GetComponent<dfLabel>();
        if( info == null )
        {
            this.enabled = false;
            throw new Exception( "No Label component found" );
        }

        info.Text = "";
    }
Beispiel #29
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);
    }
    void Awake()
    {
        mPanel = (dfPanel)gameObject.GetComponent (typeof(dfPanel));
        mAlertText = (dfLabel)gameObject.GetComponentInChildren (typeof(dfLabel));
        mPanel.enabled = false;

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

        /**
         * Persist the LoadingPanel between scenes
         */
        DontDestroyOnLoad (gameObject);
    }
Beispiel #32
0
    void Start()
    {
        label = GetComponent <dfLabel>();
        if (label == null)
        {
            Debug.LogError("FPS Counter needs a Label component!");
        }

        timeleft = updateInterval;

        label.Text = "";
    }
Beispiel #33
0
    protected override void initialize()
    {
        base.initialize();

        tooltip = findControl( "Tooltip" ) as dfLabel;
        if( tooltip != null )
        {
            tooltip.Text = "";
        }

        initializeOptionItems();
    }
Beispiel #34
0
 public static ISubscription bind <T>(
     this IRxRef <T> subject, dfLabel control,
     Fn <T, string> mapper, Fn <string, T> comapper
     )
 {
     return(subject.bind(
                mapper, comapper,
                text => control.Text = text,
                handler => control.TextChanged += handler,
                handler => control.TextChanged -= handler
                ));
 }
Beispiel #35
0
    public void UpdateChart(int pNumberOfPlayers, int[] data)
    {
        dfTextureSprite[] l = uBars.GetComponentsInChildren <dfTextureSprite>();
        l = l.OrderBy(o => o.Position.x).ToArray();

        for (int i = 0; i < Game.RECORDING_COUNTDOWN; i++)
        {
            l[i].FillAmount = (float)data[i] / (float)pNumberOfPlayers;
            dfLabel label = l[i].gameObject.GetComponentInChildren <dfLabel>();
            label.Text = data[i].ToString();
        }
    }
Beispiel #36
0
 // Use this for initialization
 void Start()
 {
     if(labelToModify == null) {
         labelToModify = this.GetComponent<dfLabel>();
     }
     if(CaseHandler.Instance.currentCase == CaseToShow) {
         if(text != null) {
             labelToModify.Text = text.text;
         } else {
             labelToModify.Text = value;
         }
     }
 }
Beispiel #37
0
 public static ISubscription bind(
     this IObservable <uint> subject, dfLabel control
     )
 {
     return(withTween(set => subject.subscribe(value => {
         set(Go.to(
                 TF.a(
                     () => (int)uintComapper(control.Text),
                     v => control.Text = v.ToString()
                     ), TWEEN_DURATION, tCfg.intProp(TF.Prop, (int)value)
                 ));
         control.Text = value.ToString();
     })));
 }
Beispiel #38
0
    public void AddText(string str, bool bFromServer = false)
    {
        if (bFromServer)
        {
            str = string.Concat("[color #00ffff]", str, "[/color]\n");
        }
        dfLabel _dfLabel = this.consoleOutput;

        _dfLabel.Text = string.Concat(_dfLabel.Text, str, "\n");
        this.TrimBuffer();
        if (this.consoleScroller.Value >= this.consoleScroller.MaxValue - this.consoleScroller.ScrollSize - 50f)
        {
            this.shouldScrollDown = true;
        }
    }
Beispiel #39
0
    private void ShowFloatingText(string text, Color32 color)
    {
        dfTweenVector3 tween = label.GetComponent <dfTweenVector3>();

        tween.StartValue = GUI.WorldPointToGUI(gameObject.transform.position) + new Vector2(0, -10);

        dfLabel glabel = GUI.AddPrefab(label) as dfLabel;

        glabel.RelativePosition = GUI.WorldPointToGUI(gameObject.transform.position) + new Vector2(0, -10);
        glabel.BottomColor      = color;
        float effectiveFontSize = 16;

        glabel.TextScale = (float)effectiveFontSize / (float)glabel.Font.FontSize;
        glabel.Text      = text;
    }
    // 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;
    }
    // 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;
    }
    // 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;
    }
Beispiel #43
0
 // Use this for initialization
 void Awake()
 {
     this.label    = GetComponent <dfLabel>();
     this.posTween = GetComponent <dfTweenVector3>();
     dfTweenFloat[] tweens = GetComponents <dfTweenFloat>();
     foreach (dfTweenFloat tw in tweens)
     {
         if (tw.TweenName.Equals("Scale width"))
         {
             widthTween = tw;
         }
         else
         {
             heightTween = tw;
         }
     }
 }
    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;
    }
Beispiel #45
0
 private void OnEnable()
 {
     this.label = base.GetComponent<dfLabel>();
 }
Beispiel #46
0
    // Use this for initialization
	void Start () 
    {
        time = gameObject.GetComponent<dfLabel>();
    }
	void Awake () {
        tween = GetComponent<dfTweenFloat>();
        l = GetComponent<dfLabel>();	
	}
Beispiel #48
0
 void Start()
 {
     lblTemplate = GetComponentInChildren<dfLabel>();
     lblTemplate.IsVisible = false;
 }
Beispiel #49
0
	// Use this for initialization
	void Start () {
        gc = this;
        Icon = GetComponent<dfSprite>();
        Label = GetComponentInChildren<dfLabel>();
	}
    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() : "";
    }
 // Called by Unity just before any of the Update methods is called the first time.
 public void Start()
 {
     // Obtain a reference to the dfLabel instance attached to this object
     this._label = GetComponent<dfLabel>();
 }
 public void Start()
 {
     if( _label == null )
     {
         this._label = GetComponent<dfLabel>();
         _label.Text = "Touch State";
     }
 }
 public LabelTween(float l, dfLabel lbl, float t)
 {
     length = l;
     label = lbl;
     target = t;
 }
 public void Start()
 {
     this.label = GetComponent<dfLabel>();
 }
Beispiel #55
0
    protected override void initialize()
    {
        base.initialize();

        if( Tooltip == null )
        {
            Tooltip = findControl( "Tooltip" ) as dfLabel;
        }

        if( Tooltip != null )
        {
            Tooltip.Text = "";
        }

        #region Initialize menu items

        items = GetComponentsInChildren<DemoMenuItem>().ToList();
        items.Sort();

        var length = items.Count;
        for( int i = 0; i < length; i++ )
        {

            var item = items[ i ];
            var itemIndex = i;

            // Perform item-specific initialization
            item.Initialize();

            // Attach keyboard navigation events
            item.Control.KeyDown += ( dfControl sender, dfKeyEventArgs args ) =>
            {

                if( args.Used )
                    return;

                if( args.KeyCode == KeyCode.DownArrow )
                {
                    selectNext( itemIndex );
                    args.Use();
                }
                else if( args.KeyCode == KeyCode.UpArrow )
                {
                    selectPrevious( itemIndex );
                    args.Use();
                }
                else if( args.KeyCode == KeyCode.Space || args.KeyCode == KeyCode.Return )
                {
                    var target = item.Submenu;
                    if( target != null )
                    {
                        showSubmenu( target );
                    }
                    args.Use();
                }

            };

            // Display the item's tooltip on focus
            item.Control.EnterFocus += ( dfControl sender, dfFocusEventArgs args ) =>
            {
                selected = item;
                if( Tooltip != null )
                {
                    Tooltip.Text = item.Tooltip;
                }
            };

            // Display the item's submenu on click
            item.Control.Click += ( dfControl sender, dfMouseEventArgs args ) =>
            {

                if( args.Used )
                    return;

                var target = item.Submenu;
                if( target != null )
                {
                    showSubmenu( target );
                }

                args.Use();

            };

        }

        #endregion

        if( AutoShow )
        {
            this.Show();
        }
    }
 void Awake()
 {
     label = GetComponent<dfLabel>();
 }