Exemplo n.º 1
0
 public override void ShowDialog()
 {
     base.ShowDialog();
     if (events.HasEvent("OnShow") == true)
     {
         events.Trigger("OnShow", this);
     }
 }
Exemplo n.º 2
0
    public void OnClicked()
    {
        // These names should actually be something like "button_my" in order to be localized.
        // However, just to make sure, we replace this to avoid any problems.
        buttonName = buttonName.Replace(" ", "_");
        EventActions dialogEvents = transform.GetComponentInParent <ModDialogBox>().events;

        Debug.ULogChannel("ModDialogBox", "Calling On" + buttonName + "Clicked function");

        if (dialogEvents.HasEvent("On" + buttonName + "Clicked") == true)
        {
            Debug.ULogChannel("ModDialogBox", "Found On" + buttonName + "Clicked event");
            dialogEvents.Trigger <ModDialogBox>("On" + buttonName + "Clicked", transform.GetComponentInParent <ModDialogBox>());
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Copy Constructor -- don't call this directly, unless we never
    /// do ANY sub-classing. Instead use Clone(), which is more virtual.
    /// </summary>
    private Furniture(Furniture other)
    {
        Type                = other.Type;
        typeTags            = new HashSet <string>(other.typeTags);
        MovementCost        = other.MovementCost;
        PathfindingModifier = other.PathfindingModifier;
        PathfindingWeight   = other.PathfindingWeight;
        RoomEnclosure       = other.RoomEnclosure;
        Width               = other.Width;
        Height              = other.Height;
        CanRotate           = other.CanRotate;
        Rotation            = other.Rotation;
        Tint                = other.Tint;
        LinksToNeighbour    = other.LinksToNeighbour;
        health              = other.health;

        Parameters = new Parameter(other.Parameters);
        Jobs       = new BuildableJobs(this, other.Jobs);

        // add cloned components
        components = new HashSet <BuildableComponent>();
        foreach (BuildableComponent component in other.components)
        {
            components.Add(component.Clone());
        }

        // add cloned order actions
        orderActions = new Dictionary <string, OrderAction>();
        foreach (var orderAction in other.orderActions)
        {
            orderActions.Add(orderAction.Key, orderAction.Value.Clone());
        }

        if (other.Animation != null)
        {
            Animation = other.Animation.Clone();
        }

        if (other.EventActions != null)
        {
            EventActions = other.EventActions.Clone();
        }

        if (other.contextMenuLuaActions != null)
        {
            contextMenuLuaActions = new List <ContextMenuLuaAction>(other.contextMenuLuaActions);
        }

        if (other.ReplaceableFurniture != null)
        {
            replaceableFurniture = other.ReplaceableFurniture;
        }

        isEnterableAction = other.isEnterableAction;

        getProgressInfoNameAction = other.getProgressInfoNameAction;

        tileTypeBuildPermissions = new HashSet <string>(other.tileTypeBuildPermissions);

        RequiresSlowUpdate = EventActions.HasEvent("OnUpdate") || components.Any(c => c.RequiresSlowUpdate);

        RequiresFastUpdate = EventActions.HasEvent("OnFastUpdate") || components.Any(c => c.RequiresFastUpdate);

        LocalizationCode       = other.LocalizationCode;
        UnlocalizedDescription = other.UnlocalizedDescription;

        // force true as default, to trigger OnIsOperatingChange (to sync the furniture icons after initialization)
        IsOperating = true;
    }