Inheritance: MonoBehaviour
Exemple #1
0
    public ContainerComponent CreateContainer(Vector3 position)
    {
        ContainerComponent newContainer = Instantiate(Container, position, Quaternion.identity, transform);

        newContainer.gameObject.SetActive(true);
        InstantiatedContainers.Add(newContainer);
        return(newContainer);
    }
    public bool OnCookOveride()
    {
        ContainerComponent container = transform.parent.GetComponent <ContainerComponent>();

        //check if we are in water
        if (container == null || !container.HoldingWater)
        {
            cookableObject.IsCooked = true;
            cookableObject.IsBurnt  = true;
            return(true);
        }
        return(false);
    }
Exemple #3
0
    public ContainerComponent GetContainer(ColorName color)
    {
        ContainerComponent foundContainer = null;

        foreach (ContainerComponent container in _component.InstantiatedContainers)
        {
            if (container.Color == color)
            {
                foundContainer = container;
            }
        }

        return(foundContainer);
    }
Exemple #4
0
        public static IPDFTemplate GetDataContent(this ContainerComponent container, string dataContent, PDFContextBase context)
        {
            if (string.IsNullOrEmpty(dataContent))
            {
                return(null);
            }

            Component found;

            if (dataContent.StartsWith("#"))
            {
                found = container.Document.FindAComponentById(dataContent.Substring(1));
            }
            else
            {
                found = container.Document.FindAComponentByName(dataContent);
            }

            if (null == found)
            {
                if (context.Conformance == ParserConformanceMode.Strict)
                {
                    throw new PDFParserException("Could not load the data-content, as no element could be found with a matching ID or name " + dataContent);
                }
                else
                {
                    context.TraceLog.Add(TraceLevel.Error, "HTML", "Could not load the data-content, as no element could be found with a matching ID or name " + dataContent);
                }

                return(null);
            }
            else if (!(found is IPDFTemplate))
            {
                if (context.Conformance == ParserConformanceMode.Strict)
                {
                    throw new PDFParserException("Could not load the data-content, the element with ID or name " + dataContent + " does not support template creation");
                }
                else
                {
                    context.TraceLog.Add(TraceLevel.Error, "HTML", "Could not load the data-content, the element with ID or name " + dataContent + " does not support template creation");
                }

                return(null);
            }
            else
            {
                return(found as IPDFTemplate);
            }
        }
        public void BuildContainer(NodeAddedEvent e, HangarTankBaseSystem.HangarNode hangar, ContainerItemPreviewLoadedNode container, HangarTankBaseSystem.HangarCameraNode hangarCamera, SingleNode <MainScreenComponent> screen)
        {
            screen.component.HideNewItemNotification();
            Transform          containerPosition   = hangar.hangarContainerPosition.transform;
            ContainerComponent componentInChildren = hangar.hangarContainerPosition.GetComponentInChildren <ContainerComponent>();

            if ((componentInChildren != null) && (componentInChildren.assetGuid == container.assetReference.Reference.AssetGuid))
            {
                base.ScheduleEvent <HangarContainerBuildedEvent>(hangar);
            }
            else
            {
                this.BuildContainer(containerPosition, container.resourceData.Data, hangarCamera.cameraRootTransform.Root);
                containerPosition.GetComponentInChildren <ContainerComponent>().assetGuid = container.assetReference.Reference.AssetGuid;
                base.ScheduleEvent <HangarContainerBuildedEvent>(hangar);
            }
        }
Exemple #6
0
    private void OnCollisionEnter(Collision2D other)
    {
        BoxComponent boxComponent = other.gameObject.GetComponent <BoxComponent>();

        if (boxComponent != null)
        {
            _component.MovementDirection = RobotComponent.HorizontalDirection.Stationary;
            _state = State.Throwing;
            boxComponent.Transform.position = _component.transform.position + Vector3.up;                    // TODO animate
            ContainerComponent container = _level.GetContainer(boxComponent.Color);
            float throwDistance          = container.transform.position.x - _component.transform.position.x; // TODO make better estimate
            float throwDirection         = Mathf.Sign(throwDistance);
            float throwForce             = Mathf.Abs(throwDistance) + 3;
            float throwY = throwDistance < 1 ? 2 : 1;
            boxComponent.RigidBody.velocity = throwForce * new Vector2(throwDirection, throwY).normalized;
            _state = State.Idle;
        }
    }
Exemple #7
0
    private void SpawnContainers()
    {
        if (_component.ContainerSpawns.Length < 2)
        {
            Debug.LogWarning("Warning: insufficient containers. Link more spawn points to containers.");
        }

        ColorName colorName = ColorName.Colorless;

        foreach (Transform spawn in _component.ContainerSpawns)
        {
            if (Enum.IsDefined(typeof(ColorName), ++colorName))
            {
                ContainerComponent containerComponent = _component.CreateContainer(spawn.position);
                containerComponent.Color = colorName;
            }
            else
            {
                break;
            }
        }
    }
    static async Task <ConversionResult> RenderToResult(Render target)
    {
        await using var provider = GetProvider(target);
        var loggerFactory = target.LoggerFactory ?? NullLoggerFactory.Instance;
        var renderer      = new TestRenderer(provider, loggerFactory);

        var root       = new ContainerComponent(renderer);
        var parameters = target.ParameterView ?? ParameterView.Empty;

        var type       = target.Type;
        var dispatcher = root.RenderHandle.Dispatcher;
        await root.RenderComponentUnderTest(type, parameters);

        var(componentId, component) = root.FindComponentUnderTest();
        if (target.BeforeRender != null)
        {
            target.BeforeRender(component);
            await dispatcher.InvokeAsync(() => { stateHasChanged.Invoke(component, null); });

            await root.RenderComponentUnderTest(type, parameters);
        }

        var html = Htmlizer.GetHtml(renderer, componentId);

        var stream = new MemoryStream();

        await using var writer = stream.BuildLeaveOpenWriter();
        writer.WriteLine(html);

        var info = new ComponentInfo(component, html.Replace("\r\n", "\n").Length.ToString("N0"));

        return(new ConversionResult(
                   info,
                   new List <ConversionStream>
        {
            new ConversionStream("html", stream)
        }));
    }
Exemple #9
0
        public static void AddDataContent(this ContainerComponent container, string dataContent, PDFContextBase context)
        {
            var found = GetDataContent(container, dataContent, context);

            if (null == found)
            {
                return;
            }

            var content = found.Instantiate(0, container);

            if (null != content)
            {
                IPDFContainerComponent icontainer = container;

                foreach (var item in content)
                {
                    if (item is Component)
                    {
                        icontainer.Content.Add((Component)item);
                    }
                }
            }
        }
Exemple #10
0
 public static void appendChild(ContainerComponent parent, UnityComponent child)
 {
     child.SetParent(parent);
     parent.ScheduleLayout();
 }
Exemple #11
0
 public static void removeChild(ContainerComponent parent, UnityComponent child)
 {
     child.Destroy();
     parent.ScheduleLayout();
 }
 public LayoutEngineCanvas(ContainerComponent component, IPDFLayoutEngine parent)
     : base(component, parent)
 {
 }
Exemple #13
0
 internal RenderedComponent(StaticRenderer renderer)
 {
     this.renderer = renderer;
     container     = new(this.renderer);
 }
 public int AttachTestRootComponent(ContainerComponent testRootComponent)
 => AssignRootComponentId(testRootComponent);
Exemple #15
0
 public static void insertBefore(ContainerComponent parent, UnityComponent child, UnityComponent beforeChild)
 {
     child.SetParent(parent, beforeChild);
     parent.ScheduleLayout();
 }
Exemple #16
0
        //
        // ctor
        //

        #region protected LayoutEnginePanel(PDFContainerComponent container, IPDFLayoutEngine parent)

        /// <summary>
        ///
        /// </summary>
        /// <param name="container"></param>
        /// <param name="context"></param>
        /// <param name="fullstyle"></param>
        public LayoutEnginePanel(ContainerComponent container, IPDFLayoutEngine parent)
            : base(container, parent)
        {
        }
Exemple #17
0
 public TSpanLayoutEngine(ContainerComponent container, IPDFLayoutEngine parent)
     : base(container, parent)
 {
 }