コード例 #1
0
    public void ReplaceKittyAmountDisplay(ValueDisplayWidget newKittyAmountDisplayWidget)
    {
        var index     = GameComponentsLookup.KittyAmountDisplay;
        var component = (KittyAmountDisplayComponent)CreateComponent(index, typeof(KittyAmountDisplayComponent));

        component.KittyAmountDisplayWidget = newKittyAmountDisplayWidget;
        ReplaceComponent(index, component);
    }
コード例 #2
0
    public GameEntity SetKittyAmountDisplay(ValueDisplayWidget newKittyAmountDisplayWidget)
    {
        if (hasKittyAmountDisplay)
        {
            throw new Entitas.EntitasException("Could not set KittyAmountDisplay!\n" + this + " already has an entity with KittyAmountDisplayComponent!",
                                               "You should check if the context already has a kittyAmountDisplayEntity before setting it or use context.ReplaceKittyAmountDisplay().");
        }
        var entity = CreateEntity();

        entity.AddKittyAmountDisplay(newKittyAmountDisplayWidget);
        return(entity);
    }
コード例 #3
0
    public void ReplaceKittyAmountDisplay(ValueDisplayWidget newKittyAmountDisplayWidget)
    {
        var entity = kittyAmountDisplayEntity;

        if (entity == null)
        {
            entity = SetKittyAmountDisplay(newKittyAmountDisplayWidget);
        }
        else
        {
            entity.ReplaceKittyAmountDisplay(newKittyAmountDisplayWidget);
        }
    }