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); } } }
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); }
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; }
/// <inheritdoc /> public IExtensionContext CreateExtensionContext(IDescribable describable) { var extensionInfo = new ExtensionContext(describable); this.extensions.Add(extensionInfo); return(extensionInfo); }
/// <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); } }
/// <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(); }
protected virtual void SetDescribableCommon(IDescribable describable) { //Debug.Log("DescribableIcon.SetDescribableCommon(" + describable.MyName + ")"); this.MyDescribable = describable; UpdateVisual(); UIManager.MyInstance.RefreshTooltip(describable as IDescribable); }
/// <inheritdoc /> public IBehaviorContext CreateBehaviorContext(IDescribable describable) { var behaviorInfo = new BehaviorContext(describable); this.behaviors.Add(behaviorInfo); return behaviorInfo; }
/// <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; }
public DecoratorBase(IIdentifiable identifiable, IDescribable descibable, IOutputItem decorated, IInputItem target) { _identifiable = identifiable; _describable = descibable; _decorated = decorated; _target = target; }
/// <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(); }
/// <inheritdoc /> public IExtensionContext CreateExtensionContext(IDescribable describable) { var extensionInfo = this.CreateExtensionContextCore(describable); this.extensions.Add(extensionInfo); return extensionInfo; }
public FactoryBase(string id, IDescribable info) { _id = id; _info = info; _adapters.Add(Linear.Identifier, Linear.Describable); }
/// <inheritdoc /> public IExecutableContext CreateExecutableContext(IDescribable describable) { var executableInfo = this.CreateExecutableContextCore(describable); this.executables.Add(executableInfo); return(executableInfo); }
/// <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); }
/// <inheritdoc /> public IBehaviorContext CreateBehaviorContext(IDescribable describable) { var behaviorInfo = new BehaviorContext(describable); this.behaviors.Add(behaviorInfo); return(behaviorInfo); }
/// <inheritdoc /> public IExecutableContext CreateExecutableContext(IDescribable describable) { var executableInfo = new ExecutableContext(describable); this.executables.Add(executableInfo); return executableInfo; }
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(); }
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); } }
/// <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(); }
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")); } }
/// <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(); }
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)); }
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); }
public static Describable CreateDescribable(IDescribable describable) { var ret = new Describable() { name = describable.Name, description = describable.Description }; return(ret); }
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); } }
/// <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); } }
public void RefreshTooltip(IDescribable describable, string showSellPrice) { if (describable != null && toolTipText != null && toolTipText.text != null) { ShowToolTipCommon(describable, showSellPrice); //toolTipText.text = description.GetDescription(); } else { HideToolTip(); } }
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); } }
/// <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; }
/// <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); }
//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; } }
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); } }
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); } }
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; }
/// <inheritdoc /> public IExecutionContext CreateRunExecutionContext(IDescribable describable) { this.Run = new ExecutionContext(describable); return this.Run; }
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); }
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); }
private static ExecutableContext CreateTestee(IDescribable describable) { return new ExecutableContext(describable); }
public Category(object obj, IDescribable describes) : base(describes) { _value = obj; }
private static BehaviorContext CreateTestee(IDescribable describable) { return new BehaviorContext(describable); }
static Quantity GetQuantity(IDescribable describes, IDimension iDimension) { return GetQuantity(describes, iDimension, 1); }
/// <inheritdoc /> public IExecutionContext CreateShutdownExecutionContext(IDescribable describable) { this.Shutdown = new ExecutionContext(describable); return this.Shutdown; }
/// <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); }
/// <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); }
/// <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); }
private static ExtensionContext CreateTestee(IDescribable describable) { return new ExtensionContext(describable); }