Exemple #1
0
 public void Initialize(EditorController controller, FrEdLibrary.LibraryItem libraryItem)
 {
     this.controller   = controller;
     this.item         = libraryItem;
     this.image.sprite = this.item.sprite;
     DeselectAll      += this.Deselect;
 }
    private void Awake()
    {
        // setup entity drawer tween props
        this.currentlySelectedButton = this.pickButton;
        Vector3 hidePos = new Vector3(0.0f, -110.0f, 0.0f);

        this.hideDrawer = new TweenParms()
                          .Ease(EaseType.EaseInSine)
                          .OnComplete(
            () => {
            this.entityDrawerIsAnimating = false;
        }
            )
                          .Prop("localPosition", hidePos, true);

        Vector3 showPos = new Vector3(0.0f, 110.0f, 0.0f);

        this.showDrawer = new TweenParms()
                          .Ease(EaseType.EaseInSine)
                          .OnComplete(
            () => {
            this.entityDrawerIsAnimating = false;
        }
            )
                          .Prop("localPosition", showPos, true);


        // populate entity drawer
        for (int i = 0; i < (int)FrEdLibrary.Type.End; ++i)
        {
            FrEdLibrary.LibraryItem item = null;
            switch ((FrEdLibrary.Type)i)
            {
            default:
                item = FrEdLibrary.instance.GetLibraryItem((FrEdLibrary.Type)i);
                break;

            // Ignore markers, blocks, projectiles, invisible things
            case FrEdLibrary.Type.None:
            case FrEdLibrary.Type.End:
            case FrEdLibrary.Type.Block:
            case FrEdLibrary.Type.Animation:
            case FrEdLibrary.Type.Particles:
            case FrEdLibrary.Type.SetMusic:
            case FrEdLibrary.Type.SetSky:
            case FrEdLibrary.Type.NinjaStar:
            case FrEdLibrary.Type.RoundBullet:
            case FrEdLibrary.Type.HomingMissile:
            case FrEdLibrary.Type.SpikyHomingMissile:
            case FrEdLibrary.Type.DetailBlock:
            case FrEdLibrary.Type.Decoration:
            case FrEdLibrary.Type.PlayerSpawn:
                break;
            }

            if (item != null)
            {
                EntityDrawerItem drawerItem = GameObject.Instantiate <EntityDrawerItem>(this.drawerItem, this.drawerContainer);
                drawerItem.Initialize(this.controller, item);
            }
        }
    }