Beispiel #1
0
    /// <summary>
    /// Name of the selected sprite.
    /// </summary>

    //public string spriteName { get { return (mSprite != null) ? mSprite.spriteName : mName; } }

    /// <summary>
    /// Show the selection wizard.
    /// </summary>

    public static void Show(NJGAtlas atlas, string selected, Callback callback)
    {
        IconSelector comp = ScriptableWizard.DisplayWizard <IconSelector>("Select a Sprite");

        comp.mAtlas    = atlas;
        comp.mSprite   = selected;
        comp.mCallback = callback;
    }
    /// <summary>
    /// Draw a sprite selection field.
    /// </summary>

    static public void IconField(string fieldName, string sprite,
                                 IconSelector.Callback callback, params GUILayoutOption[] options)
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label(fieldName, GUILayout.Width(116f));

        if (GUILayout.Button(string.IsNullOrEmpty(sprite) ? "Select Icon" : sprite, "MiniPullDown", options))
        {
            IconSelector.Show(NJGMapOnGUI.instance.atlas, sprite, callback);
        }
        GUILayout.EndHorizontal();
    }
Beispiel #3
0
    public void MakeMove()
    {
        Tiles oldTileVal = CurrentSpace.Value;

        CurrentSpace.Value = IconSelector.Current;
        if (board.board.IsBoardValid())
        {
            if (oldTileVal == CurrentSpace.Value)
            {
                CurrentSpace.Direction = (Dir)
                                         (((int)CurrentSpace.Direction + 90) % 360);
                //Debug.Log ("Dir changed! new dir is:");
                //Debug.Log (CurrentSpace.Direction);
                var rotation = new Vector3(0, (float)-90, 0);
                CurrentTile.transform.Rotate(rotation);
            }
            else
            {
                var newTile = IconSelector.CreateTile(IconSelector.Current);
                CurrentTile = newTile;
                //CurrentSpace.Direction = IconSelector.CurrentSelectDir;
                newTile.transform.parent        = this.transform;
                newTile.transform.localPosition = Vector3.zero;
            }

            board.board.UpdateWater();
            if (clip)
            {
                GetComponent <AudioSource>().PlayOneShot(clip);
            }
        }
        else
        {
            if (failClip)
            {
                GetComponent <AudioSource>().PlayOneShot(failClip);
            }
            CurrentSpace.Value = oldTileVal;
        }
    }