Example #1
0
        public void PrepareActivity()
        {
            PNJ.transform.position = new Vector3(PNJ_InitialPosition.position.x, PNJ.transform.position.y, PNJ_InitialPosition.position.z);

            //Debug.Log("[PizzaGame] PrepareActivity, PNJPosition : " + PNJ.transform.position);

            if (configs.Count > 0)
            {
                currentConfig = configs[0];

                currentPizzasGroup = new List <GameObject>();

                int i = 0;
                while (i < pizzasPool.Count && i < currentConfig.nbPizzas)
                {
                    if (!pizzasPool[i].activeInHierarchy)
                    {
                        pizzasPool[i].SetActive(true);

                        currentPizzasGroup.Add(pizzasPool[i]);
                    }
                    i++;
                }

                pizzasGroup.CalculateLayoutInputHorizontal();
                pizzasGroup.CalculateLayoutInputVertical();
                pizzasGroup.SetLayoutHorizontal();
                pizzasGroup.SetLayoutVertical();
            }
        }
Example #2
0
    public IEnumerator Opening_Padding()
    {
        CurrentStatus = EStatus.Opening_Padding;
        float PaddingRight = LayoutCloseOffset;

        while (LayoutComponent.padding.right != 0)
        {
            PaddingRight           -= (int)(MovingSpeed * Time.deltaTime);
            PaddingRight            = Mathf.Clamp(PaddingRight, 0, LayoutCloseOffset);
            LayoutComponent.padding = new RectOffset(0, (int)PaddingRight, 0, 0);
            LayoutComponent.CalculateLayoutInputHorizontal();
            yield return(null);
        }

        LayoutComponent.padding = new RectOffset();
        LayoutComponent.CalculateLayoutInputHorizontal();

        yield return(Opening_Offset());
    }
Example #3
0
        private void Render()
        {
            var click = ClickBox.RenderClickBox(gameObject);

            horizontal.CalculateLayoutInputHorizontal();
            horizontal.CalculateLayoutInputVertical();
            horizontal.SetLayoutHorizontal();
            horizontal.SetLayoutVertical();
            renderedClicks.Add(click);
        }
Example #4
0
        private void Expand(GameObject gameObject)
        {
            var aspect = gameObject.AddComponent <AspectRatioFitter>();

            aspect.aspectRatio = 1;
            aspect.aspectMode  = AspectRatioFitter.AspectMode.HeightControlsWidth;
            horizontal.CalculateLayoutInputHorizontal();
            horizontal.CalculateLayoutInputVertical();
            horizontal.SetLayoutHorizontal();
            horizontal.SetLayoutVertical();
        }
Example #5
0
        public void TestCalculateLayoutInputHorizontal()
        {
            HorizontalLayoutGroup layoutGroup = m_PrefabRoot.GetComponentInChildren <HorizontalLayoutGroup>();

            layoutGroup.CalculateLayoutInputHorizontal();
            layoutGroup.SetLayoutHorizontal();
            layoutGroup.CalculateLayoutInputVertical();
            layoutGroup.SetLayoutVertical();

            Assert.AreEqual(48, layoutGroup.minWidth);
            Assert.AreEqual(318, layoutGroup.preferredWidth);
            Assert.AreEqual(1, layoutGroup.flexibleWidth);
        }
Example #6
0
    private void RefreshMood()
    {
        if (null == SelectPet)
        {
            return;
        }
        moodRoot.SafeSetActive(modulePet.Contains(SelectPet.ID));
        layoutGroup.CalculateLayoutInputHorizontal();
        var rMood = SelectPet.Mood;

        for (var i = 0; i < moodList.Count; i++)
        {
            moodList[i].gameObject.SetActive(i == (int)rMood);
        }
    }
Example #7
0
    private static int CalculateLayoutInputHorizontal(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            HorizontalLayoutGroup horizontalLayoutGroup = (HorizontalLayoutGroup)ToLua.CheckObject(L, 1, typeof(HorizontalLayoutGroup));
            horizontalLayoutGroup.CalculateLayoutInputHorizontal();
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Example #8
0
    public static int CalculateLayoutInputHorizontal(IntPtr l)
    {
        int result;

        try
        {
            HorizontalLayoutGroup horizontalLayoutGroup = (HorizontalLayoutGroup)LuaObject.checkSelf(l);
            horizontalLayoutGroup.CalculateLayoutInputHorizontal();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
	private void ForceLayoutGroupUpdates()
	{
		HorizontalLayoutGroup inputLayout = inputsLayout.GetComponentInChildren<HorizontalLayoutGroup>();
		inputLayout.CalculateLayoutInputHorizontal();
		inputLayout.CalculateLayoutInputVertical();
		inputLayout.SetLayoutHorizontal();
		inputLayout.SetLayoutVertical();

		HorizontalLayoutGroup outputLayout = outputsLayout.GetComponentInChildren<HorizontalLayoutGroup>();
		outputLayout.CalculateLayoutInputHorizontal();
		outputLayout.CalculateLayoutInputVertical();
		outputLayout.SetLayoutHorizontal();
		outputLayout.SetLayoutVertical();

		HorizontalLayoutGroup deviceLayout = hackingDeviceLayout.GetComponent<HorizontalLayoutGroup>();
		deviceLayout.CalculateLayoutInputHorizontal();
		deviceLayout.CalculateLayoutInputVertical();
		deviceLayout.SetLayoutHorizontal();
		deviceLayout.SetLayoutVertical();
	}
Example #10
0
        public void TestCalculateLayoutHorizontal()
        {
            var parentGO      = m_PrefabRoot.transform.GetChild(0).GetChild(0);
            var element1GO    = parentGO.GetChild(0);
            var element1Trans = element1GO.GetComponent <RectTransform>();
            var element2GO    = parentGO.GetChild(1);
            var element2Trans = element2GO.GetComponent <RectTransform>();
            var element3GO    = parentGO.GetChild(2);
            var element3Trans = element3GO.GetComponent <RectTransform>();

            HorizontalLayoutGroup layoutGroup = m_PrefabRoot.GetComponentInChildren <HorizontalLayoutGroup>();

            layoutGroup.CalculateLayoutInputHorizontal();
            layoutGroup.SetLayoutHorizontal();
            layoutGroup.CalculateLayoutInputVertical();
            layoutGroup.SetLayoutVertical();

            Assert.AreEqual(13.6f, element1Trans.anchoredPosition.x, 0.1f);
            Assert.AreEqual(31.3f, element2Trans.anchoredPosition.x, 0.1f);
            Assert.AreEqual(66.6f, element3Trans.anchoredPosition.x, 0.1f);
        }
Example #11
0
 public void RefreshLayout()
 {
     Canvas.ForceUpdateCanvases();
     hlg.CalculateLayoutInputHorizontal();
     hlg.SetLayoutHorizontal();
 }