Пример #1
0
    public override bool GetBindingValue(ref string value, BindingItem binding)
    {
        string fieldName = binding.FieldName;

        if (fieldName != null)
        {
            if (fieldName == "respondentname")
            {
                if (base.xui.Dialog.otherEntitySDX != null)
                {
                    EntityAliveSDX myEntity = base.xui.Dialog.otherEntitySDX as EntityAliveSDX;
                    if (myEntity)
                    {
                        if (myEntity.GetHireCost() <= 0)
                        {
                            value = myEntity.EntityName;
                        }
                        else
                        {
                            value = myEntity.EntityName;// + " ( Hire for " + myEntity.GetHireCost() + " " + myEntity.GetHireCurrency().ItemClass.Name + " )";
                        }
                        return(true);
                    }
                }
                value = ((!(base.xui.Dialog.Respondent != null)) ? string.Empty : Localization.Get(base.xui.Dialog.Respondent.EntityName, string.Empty));
                return(true);
            }
        }
        return(false);
    }
Пример #2
0
    public override void OnOpen()
    {
        LocalPlayerUI uiforPlayer = base.xui.playerUI;

        // The respondent is an EntityNPC, and we don't have that. Check for the patch scripted otherEntitySDX.
        Entity respondent = uiforPlayer.xui.Dialog.Respondent;

        if (respondent == null)
        {
            respondent = uiforPlayer.xui.Dialog.otherEntitySDX;
        }

        if (respondent != null)
        {
            EntityAliveSDX myEntity = uiforPlayer.entityPlayer.world.GetEntity(respondent.entityId) as EntityAliveSDX;
            if (myEntity != null)
            {
                this.hireInformationLabel.Text = "Hire " + myEntity.EntityName + " for " + myEntity.GetHireCost() + " " + myEntity.GetHireCurrency().ItemClass.GetLocalizedItemName() + "?";
            }
        }

        base.OnOpen();
    }