コード例 #1
0
        public void ShowToolTipCommon(IDescribable describable, string showSellPrice)
        {
            //Debug.Log("UIManager.ShowToolTipCommon(" + (describable == null ? "null" : describable.DisplayName) + ", " + showSellPrice + ")");
            if (describable == null)
            {
                HideToolTip();
                return;
            }

            // show new price
            toolTipText.text = describable.GetDescription();
            if (toolTipCurrencyBarController != null)
            {
                toolTipCurrencyBarController.ClearCurrencyAmounts();
                if (describable is Item && showSellPrice != string.Empty)
                {
                    KeyValuePair <Currency, int> sellAmount = (describable as Item).GetSellPrice();
                    if (sellAmount.Value == 0 || sellAmount.Key == null)
                    {
                        // don't print a sell price on things that cannot be sold
                        return;
                    }
                    toolTipCurrencyBarController.UpdateCurrencyAmount(sellAmount.Key, sellAmount.Value, showSellPrice);
                }
            }
        }
コード例 #2
0
        public void ShowToolTip(Vector3 position, IDescribable describable, string showSellPrice)
        {
            if (describable == null)
            {
                HideToolTip();
                return;
            }
            int pivotX;
            int pivotY;

            if (Input.mousePosition.x < (Screen.width / 2))
            {
                pivotX = 0;
            }
            else
            {
                pivotX = 1;
            }
            if (Input.mousePosition.y < (Screen.height / 2))
            {
                pivotY = 0;
            }
            else
            {
                pivotY = 1;
            }
            ShowToolTip(new Vector2(pivotX, pivotY), position, describable, showSellPrice);
        }
コード例 #3
0
        public void ShowGamepadTooltip(RectTransform paneltransform, Transform buttonTransform, IDescribable describable, string sellPriceString)
        {
            //Debug.Log("UIManager.ShowGamepadTooltip()");
            //Rect panelRect = RectTransformToScreenSpace((BagPanel.ContentArea as RectTransform));
            toolTipPanelTransform  = paneltransform;
            toolTipButtonTransform = buttonTransform;
            toolTipDescribable     = describable;
            toolTipSellString      = sellPriceString;

            Vector3[] WorldCorners = new Vector3[4];
            paneltransform.GetWorldCorners(WorldCorners);
            float xMin = WorldCorners[0].x;
            float xMax = WorldCorners[2].x;

            //Debug.Log("panel bounds: xmin: " + xMin + "; xmax: " + xMax);

            if (Mathf.Abs((Screen.width / 2f) - xMin) < Mathf.Abs((Screen.width / 2f) - xMax))
            {
                // left side is closer to center of the screen
                ShowToolTip(new Vector2(1, 0.5f), new Vector3(xMin, buttonTransform.position.y, 0f), describable, sellPriceString);
            }
            else
            {
                // right side is closer to the center of the screen
                ShowToolTip(new Vector2(0, 0.5f), new Vector3(xMax, buttonTransform.position.y, 0f), describable, sellPriceString);
            }
            //uIManager.ShowToolTip(transform.position, inventorySlot.Item, "Sell Price: ");
            toolTipVisible = true;
        }
コード例 #4
0
        /// <inheritdoc />
        public IExtensionContext CreateExtensionContext(IDescribable describable)
        {
            var extensionInfo = new ExtensionContext(describable);

            this.extensions.Add(extensionInfo);
            return(extensionInfo);
        }
コード例 #5
0
        /// <summary>
        /// Show the tooltip
        /// </summary>
        public void ShowToolTip(Vector2 pivot, Vector3 position, IDescribable describable, string showSellPrice)
        {
            //Debug.Log("UIManager.ShowToolTip(" + pivot + ", " + position + ", " + (describable == null ? "null" : describable.DisplayName) + ", " + showSellPrice + ")");
            if (describable == null)
            {
                HideToolTip();
                return;
            }
            tooltipRect.pivot = pivot;
            gameObject.SetActive(true);

            transform.position = position;
            ShowToolTipCommon(describable, showSellPrice);
            //toolTipText.text = description.GetDescription();

            LayoutRebuilder.ForceRebuildLayoutImmediate(tooltipRect);
            float topPoint    = tooltipRect.rect.yMax + position.y;
            float bottomPoint = tooltipRect.rect.yMin + position.y;

            //Debug.Log("screen height : " + Screen.height + "; position: " + position + "; top: " + tooltipRect.rect.yMax + "; bottom: " + tooltipRect.rect.yMin);

            // move up if too low
            if (bottomPoint < 0f)
            {
                transform.position = new Vector3(transform.position.x, (transform.position.y - bottomPoint) + 20, transform.position.z);
                LayoutRebuilder.ForceRebuildLayoutImmediate(tooltipRect);
            }

            // move down if too high
            if (topPoint > Screen.height)
            {
                transform.position = new Vector3(transform.position.x, transform.position.y - ((topPoint - Screen.height) + 20), transform.position.z);
                LayoutRebuilder.ForceRebuildLayoutImmediate(tooltipRect);
            }
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtensionContext"/> class.
        /// </summary>
        /// <param name="describable">The describable.</param>
        public ExtensionContext(IDescribable describable)
        {
            Ensure.ArgumentNotNull(describable, "describable");

            this.Name        = describable.Name;
            this.Description = describable.Describe();
        }
コード例 #7
0
 protected virtual void SetDescribableCommon(IDescribable describable)
 {
     //Debug.Log("DescribableIcon.SetDescribableCommon(" + describable.MyName + ")");
     this.MyDescribable = describable;
     UpdateVisual();
     UIManager.MyInstance.RefreshTooltip(describable as IDescribable);
 }
コード例 #8
0
        /// <inheritdoc />
        public IBehaviorContext CreateBehaviorContext(IDescribable describable)
        {
            var behaviorInfo = new BehaviorContext(describable);
            this.behaviors.Add(behaviorInfo);

            return behaviorInfo;
        }
コード例 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtensionContext"/> class.
        /// </summary>
        /// <param name="describable">The describable.</param>
        public ExtensionContext(IDescribable describable)
        {
            Ensure.ArgumentNotNull(describable, "describable");

            this.Name = describable.Name;
            this.Description = describable.Describe();
        }
コード例 #10
0
 /// <summary>
 /// Sets a name on an object. This allows the code generator to give the object
 /// a more meaningful name.
 /// </summary>
 internal static void SetName(
     this IDescribable obj,
     string name)
 {
     Debug.Assert(obj.Name is null, "Names should never get set more than once.");
     obj.Name = name;
 }
コード例 #11
0
 public DecoratorBase(IIdentifiable identifiable, IDescribable descibable, IOutputItem decorated, IInputItem target)
 {
     _identifiable = identifiable;
     _describable  = descibable;
     _decorated    = decorated;
     _target       = target;
 }
コード例 #12
0
 /// <summary>
 /// Shows the tooltip
 /// </summary>
 public void ShowTooltip(Vector2 pivot, Vector3 position, IDescribable description)
 {
     tooltipRect.pivot = pivot;
     tooltip.SetActive(true);
     tooltip.transform.position = position;
     tooltipText.text           = description.GetDescription();
 }
コード例 #13
0
        /// <inheritdoc />
        public IExtensionContext CreateExtensionContext(IDescribable describable)
        {
            var extensionInfo = this.CreateExtensionContextCore(describable);

            this.extensions.Add(extensionInfo);

            return extensionInfo;
        }
コード例 #14
0
        public FactoryBase(string id, IDescribable info)
        {
            _id   = id;
            _info = info;

            _adapters.Add(Linear.Identifier,
                          Linear.Describable);
        }
コード例 #15
0
        /// <inheritdoc />
        public IExecutableContext CreateExecutableContext(IDescribable describable)
        {
            var executableInfo = this.CreateExecutableContextCore(describable);

            this.executables.Add(executableInfo);

            return(executableInfo);
        }
コード例 #16
0
ファイル: UiManager.cs プロジェクト: SteenPetersen/RPG
 /// <summary>
 /// Handles showing the tooltip when the equipment window is open
 /// </summary>
 public void ShowToolTipEquipmentView(IDescribable description, bool showSaleValue = true, float size = 1)
 {
     toolTip.SetActive(true);
     toolTip.transform.position = toolTipLocation.position;
     toolTipTitle.text          = description.GetTitle();
     toolTipStats.text          = description.GetDescription(showSaleValue);
     toolTip.GetComponent <RectTransform>().localScale = new Vector3(size, size, size);
 }
コード例 #17
0
        /// <inheritdoc />
        public IBehaviorContext CreateBehaviorContext(IDescribable describable)
        {
            var behaviorInfo = new BehaviorContext(describable);

            this.behaviors.Add(behaviorInfo);

            return(behaviorInfo);
        }
コード例 #18
0
        /// <inheritdoc />
        public IExecutableContext CreateExecutableContext(IDescribable describable)
        {
            var executableInfo = new ExecutableContext(describable);

            this.executables.Add(executableInfo);

            return executableInfo;
        }
コード例 #19
0
 public void ShowTooltip(Vector2 pivot, Vector3 position, IDescribable description)
 {
     //피벗을 따로 선언해주는 이유 : 장비창에서 왼쪽의 장비한 아이템이 화면을 넘어가서 반대로 설명창 UI를 표현하기 위해
     tooltipRect.pivot = pivot;
     tooltip.SetActive(true);
     tooltip.transform.position = position;
     tooltip.GetComponentInChildren <Text>().text = description.GetDescription();
 }
コード例 #20
0
 public void ShowTooltip(Vector3 position, IDescribable description)
 {
     //Verifies that the script is not called when destroyed during a scene transition
     //mostly due to item use on a door
     if (tooltip != null)
     {
         tooltip.ShowTooltip(position, description);
     }
 }
コード例 #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExecutableContext"/> class.
        /// </summary>
        /// <param name="describable">The describable.</param>
        public ExecutableContext(IDescribable describable)
        {
            Ensure.ArgumentNotNull(describable, "describable");

            this.behaviors = new Collection<IBehaviorContext>();

            this.Name = describable.Name;
            this.Description = describable.Describe();
        }
コード例 #22
0
 public static void DisplayLoadedPlugins()
 {
     UserInteraction.ShowMessage(String.Format("Loaded {0} command plugins\n\r", Commands.Count));
     foreach (ICommandPlugin plugin in Commands)
     {
         IDescribable description = (IDescribable)plugin;
         UserInteraction.ShowMessage(String.Format($"{description.GetName()}\n\r{description.GetDescription()}\n\r-----------\n\r"));
     }
 }
コード例 #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExecutionContext"/> class.
        /// </summary>
        /// <param name="describable">The describable.</param>
        public ExecutionContext(IDescribable describable)
        {
            Ensure.ArgumentNotNull(describable, "describable");

            this.executables = new Collection <IExecutableContext>();

            this.Name        = describable.Name;
            this.Description = describable.Describe();
        }
コード例 #24
0
ファイル: ItemBase.cs プロジェクト: muguangyuze/OpenMI
        public void Initialise(ITimeSpaceComponent iLC, IValueDefinition iVD, IElementSet iES)
        {
            _iValueDefinition = iVD;
            _iElementSet      = iES;
            _iComponent       = iLC;

            _iDescribable = new Describable(
                string.Format("{0}, {1}", _iValueDefinition.Caption, _iElementSet.Caption),
                string.Format("{0}, {1}", _iValueDefinition.Description, _iElementSet.Description));
        }
コード例 #25
0
ファイル: Loader.cs プロジェクト: albertmend/GermanOpen2018
        private static void serializer_UnknownAttribute(object sender, XmlAttributeEventArgs e)
        {
            IDescribable desc = e.ObjectBeingDeserialized as IDescribable;

            if (desc == null)
            {
                return;
            }
            desc.Properties.Add(e.Attr.Name, e.Attr.Value);
        }
コード例 #26
0
        public static Describable CreateDescribable(IDescribable describable)
        {
            var ret = new Describable()
            {
                name        = describable.Name,
                description = describable.Description
            };

            return(ret);
        }
コード例 #27
0
 public AddapterBase(IIdentifiable identifier, IDescribable described, ITimeSpaceOutput adapted, ITimeSpaceInput target)
 {
     _identifier = identifier;
     _described  = described;
     _target     = target;
     _adapted    = adapted;
     if (!_adapted.AdaptedOutputs.Contains(this))
     {
         _adapted.AddAdaptedOutput(this);
     }
 }
コード例 #28
0
 /// <summary>
 /// Sets a description on an object.
 /// </summary>
 internal static void SetDescription(
     this IDescribable obj,
     TranslationContext context,
     Func <string> describer)
 {
     if (context.AddDescriptions)
     {
         var longDescription = describer();
         obj.SetDescription(context, longDescription, null);
     }
 }
コード例 #29
0
 public void RefreshTooltip(IDescribable describable, string showSellPrice)
 {
     if (describable != null && toolTipText != null && toolTipText.text != null)
     {
         ShowToolTipCommon(describable, showSellPrice);
         //toolTipText.text = description.GetDescription();
     }
     else
     {
         HideToolTip();
     }
 }
コード例 #30
0
        private protected void Describe(TranslationContext context, IDescribable obj)
        {
            if (context.AddDescriptions && obj.LongDescription is null && obj.ShortDescription is null && !(string.IsNullOrWhiteSpace(LongDescription) || string.IsNullOrWhiteSpace(ShortDescription)))
            {
                obj.SetDescription(context, LongDescription, ShortDescription);
            }

            if (context.AddDescriptions && obj.Name is null && !string.IsNullOrWhiteSpace(Name))
            {
                obj.SetName(Name);
            }
        }
コード例 #31
0
        /// <summary>
        /// Sets a description on an object.
        /// </summary>
        internal static void SetDescription(
            this IDescribable obj,
            TranslationContext context,
            string longDescription,
            string shortDescription = null)
        {
            Debug.Assert(context.AddDescriptions, "Descriptions should only be set when requested.");
            Debug.Assert(obj.ShortDescription is null, "Descriptions should never get set more than once.");
            Debug.Assert(obj.LongDescription is null, "Descriptions should never get set more than once.");

            obj.ShortDescription = shortDescription ?? longDescription;
            obj.LongDescription  = longDescription;
        }
コード例 #32
0
    /// <summary>
    /// Affiche le tooltip
    /// </summary>
    /// <param name="pivot">Pivot du tooltip</param>
    /// <param name="position">Position du tooltip</param>
    /// <param name="itemDescription">Description du tooltip</param>
    public void ShowTooltip(Vector2 pivot, Vector3 position, IDescribable itemDescription)
    {
        // Pivot du tooltip
        tooltipRect.pivot = pivot;

        // Position du tooltip
        tooltip.transform.position = position;

        // Description du tooltip
        tooltipText.text = itemDescription.GetDescription();

        // Affichage du tooltip
        tooltip.SetActive(true);
    }
コード例 #33
0
    //public void ShowTooltip(Vector3 position, IDescribable description)
    //{
    //    toolTip.SetActive(true);
    //    toolTip.transform.position = position;
    //    toolTipTitle.text = description.GetDescription();
    //}

    public void ShowTooltip(string tooltipType, Vector2 pivot, Vector3 position, IDescribable description)
    {
        if (tooltipType == "generic")
        {
            tooltipRect.pivot = pivot;
            toolTip.SetActive(true);
            toolTip.transform.position = position;
            toolTipText.text           = description.GetDescription();
        }
        if (tooltipType == "equipment")
        {
            EquipmentTooltip.SetActive(true);
            EquipmentTooltip.transform.position = position;
        }
    }
コード例 #34
0
        private void treeFiles_AfterSelect(object sender, TreeViewEventArgs e)
        {
            IDescribable fsNode = e.Node.Tag as IDescribable;

            if (fsNode != null)
            {
                tbDescription.Text = fsNode.TextDescription;
            }
            IDataStream stream = e.Node.Tag as IDataStream;

            if (stream != null)
            {
                OnStreamSelected(stream);
            }
        }
コード例 #35
0
        public void OnPointerEnter(PointerEventData eventData)
        {
            IDescribable tmp = null;

            if (MyDescribable != null && MyDescribable is IDescribable)
            {
                tmp = (IDescribable)MyDescribable;
                //UIManager.MyInstance.ShowToolTip(transform.position);
            }// else if (MyUseables.Count > 0) {
             //UIManager.MyInstance.ShowToolTip(transform.position);
            //}
            if (tmp != null)
            {
                UIManager.MyInstance.ShowToolTip(transform.position, tmp);
            }
        }
コード例 #36
0
        public IdentifiableItemBase(IIdentifiable itemInstance, IComposition composition)
        {
            Contract.Requires(itemInstance != null, "itemInstance != null");
            Contract.Requires(composition != null, "composition != null");

            _composition = composition;

            _guid = Guid.NewGuid().ToString();

            _cachedInstanceId = itemInstance.Id;
            _cachedInstanceDescribes = new Describes(itemInstance);

            _cachedCaptionEdited = false;
            _cachedDescriptionEdited = false;

            _itemInstance = itemInstance;

            _xConstructor = Constructor(itemInstance);
            _xConnectivity = Connectivity(itemInstance);

            if (itemInstance is IBaseLinkableComponentProposed)
                _platforms = ((IBaseLinkableComponentProposed)itemInstance).SupportedPlatforms;
            else if (itemInstance is IBaseExchangeItemProposed)
                _platforms = ((IBaseExchangeItemProposed)itemInstance).SupportedPlatforms;
            else
                _platforms = composition.Platforms;

            if (itemInstance is IBaseLinkableComponent)
                _interface = IdentifiableItemType.IBaseLinkableComponent;
            else if (itemInstance is IBaseAdaptedOutput)
                _interface = IdentifiableItemType.IBaseAdaptedOutput;
            else if (itemInstance is IBaseOutput)
                _interface = IdentifiableItemType.IBaseOutput;
            else if (itemInstance is IBaseInput)
                _interface = IdentifiableItemType.IBaseInput;
            else if (itemInstance is IAdaptedOutputFactory)
                _interface = IdentifiableItemType.IAdaptedOutputFactory;
            else
                _interface = IdentifiableItemType.Unknown;
        }
コード例 #37
0
 /// <inheritdoc />
 public IExecutionContext CreateRunExecutionContext(IDescribable describable)
 {
     this.Run = new ExecutionContext(describable);
     return this.Run;
 }
コード例 #38
0
        static Quantity GetQuantity(IDescribable describes, IDimension iDimension, int dimension)
        {
            ValueDefinition vd;

            switch (dimension)
            {
                case 1:
                    vd = new ValueDefinition(describes,
                        typeof(double),
                        Double.NegativeInfinity);
                    break;
                case 2:
                    vd = new ValueDefinition(describes,
                        typeof(Vector2d<double>),
                        new Vector2d<double>(Double.NegativeInfinity));
                    break;
                case 3:
                    vd = new ValueDefinition(describes,
                        typeof(Vector3d<double>),
                        new Vector3d<double>(Double.NegativeInfinity));
                    break;
                default:
                    throw new NotImplementedException(dimension.ToString());
            }

            var unit = new Unit(describes, iDimension);

            return new Quantity(vd, unit);
        }
コード例 #39
0
        public virtual void Initialise(XElement xElement, IDocumentAccessor accessor)
        {
            xElement = Persistence.ThisOrSingleChild(XName, xElement);

            _guid = Utilities.Xml.GetAttribute(xElement, "id");
            _cachedInstanceId = Utilities.Xml.GetAttribute(xElement, "instanceId");

            var interfaceType = Utilities.Xml.GetAttribute(xElement, "interface");

            _cachedCaptionEdited = Utilities.Xml.GetAttribute(xElement, "captionEdited", false);
            _cachedDescriptionEdited = Utilities.Xml.GetAttribute(xElement, "descriptionEdited", false);

            var caption = Utilities.Xml.GetAttribute(xElement, "caption");

            var description = _cachedDescriptionEdited
                ? xElement.Element("Description").Value
                : "Description unavailable until ItemInstance(composition) accessed";

            _cachedInstanceDescribes = new Describes(caption, description);
            _cachedCaptionEdited = true;

            _xConstructor = Persistence.ThisOrSingleChild(XConstructor, xElement);
            _xConnectivity = Persistence.ThisOrSingleChild(XConnectivity, xElement);

            _platforms = Persistence.PlatformsChi.Parse(xElement, accessor);

            _interface = (IdentifiableItemType)Enum.Parse(typeof(IdentifiableItemType), interfaceType);
        }
コード例 #40
0
 private static ExecutableContext CreateTestee(IDescribable describable)
 {
     return new ExecutableContext(describable);
 }
コード例 #41
0
 public Category(object obj, IDescribable describes)
     : base(describes)
 {
     _value = obj;
 }
コード例 #42
0
 private static BehaviorContext CreateTestee(IDescribable describable)
 {
     return new BehaviorContext(describable);
 }
コード例 #43
0
 static Quantity GetQuantity(IDescribable describes, IDimension iDimension)
 {
     return GetQuantity(describes, iDimension, 1);
 }
コード例 #44
0
 /// <inheritdoc />
 public IExecutionContext CreateShutdownExecutionContext(IDescribable describable)
 {
     this.Shutdown = new ExecutionContext(describable);
     return this.Shutdown;
 }
コード例 #45
0
 /// <summary>
 /// Creates the behavior context implementation.
 /// </summary>
 /// <param name="describable">The describable which is passed to the behavior context.</param>
 /// <returns>A new instance of the behavior context implementation.</returns>
 protected virtual IBehaviorContext CreateBehaviorContextCore(IDescribable describable)
 {
     return new BehaviorContext(describable);
 }
コード例 #46
0
 /// <summary>
 /// Creates the executable context implementation.
 /// </summary>
 /// <param name="describable">The describable which is passed to the executable context.</param>
 /// <returns>A new instance of the executable context implementation.</returns>
 protected virtual IExecutableContext CreateExecutableContextCore(IDescribable describable)
 {
     return new ExecutableContext(describable);
 }
コード例 #47
0
 /// <summary>
 /// Creates the extension context implementation.
 /// </summary>
 /// <param name="describable">The describable which is passed to the extension context.</param>
 /// <returns>A new instance of the extension context implementation.</returns>
 protected virtual IExtensionContext CreateExtensionContextCore(IDescribable describable)
 {
     return new ExtensionContext(describable);
 }
コード例 #48
0
 private static ExtensionContext CreateTestee(IDescribable describable)
 {
     return new ExtensionContext(describable);
 }