Наследование: HorizontalOrVerticalLayoutGroup
 static public int SetLayoutHorizontal(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.UI.HorizontalLayoutGroup self = (UnityEngine.UI.HorizontalLayoutGroup)checkSelf(l);
         self.SetLayoutHorizontal();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Пример #2
0
 static public int CalculateLayoutInputHorizontal(IntPtr l)
 {
     try {
         UnityEngine.UI.HorizontalLayoutGroup self = (UnityEngine.UI.HorizontalLayoutGroup)checkSelf(l);
         self.CalculateLayoutInputHorizontal();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #3
0
 static public int SetLayoutVertical(IntPtr l)
 {
     try {
         UnityEngine.UI.HorizontalLayoutGroup self = (UnityEngine.UI.HorizontalLayoutGroup)checkSelf(l);
         self.SetLayoutVertical();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #4
0
 static public int SetLayoutHorizontal(IntPtr l)
 {
     try{
         UnityEngine.UI.HorizontalLayoutGroup self = (UnityEngine.UI.HorizontalLayoutGroup)checkSelf(l);
         self.SetLayoutHorizontal();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Пример #5
0
    /* Core of the game's code */
    void Update()
    {
        // This creates a small buffer timer so that the game doesn't just zip from text to text
        while (timer >= 0)
        {
            timer -= Time.deltaTime;
            return;
        }

        // Moves things along if any key is pressed
        if (!Input.anyKeyDown)
        {
            return;
        }

        // Variable for formatting
        float offset = 0;

        // If the story can continue and a key has been pressed, clears the board, creates new text, and resets timer.
        if (_inkStory.canContinue)
        {
            RemoveChildren();
            GetText(offset);
        }

        // Calls the CheckVariables method
        CheckVariables();
        EncounterDesign();

        // If there are choices and the the needChoices variable is set, then this will create the choices
        if (_inkStory.currentChoices.Count > 0 && needChoices)
        {
            for (int ii = 0; ii < _inkStory.currentChoices.Count; ++ii)
            {
                UnityEngine.UI.Button choice = Instantiate(button);
                choice.transform.SetParent(canvas.transform, false);
                choice.transform.Translate(new Vector2(0, offset));

                TextMeshProUGUI choiceText = choice.GetComponentInChildren <TextMeshProUGUI> ();
                choiceText.text = _inkStory.currentChoices [ii].text;
                StartCoroutine(FadeImageToFullAlpha(2f, choice.image));
                StartCoroutine(FadeTextToFullAlpha(2f, choice.GetComponentInChildren <TextMeshProUGUI>()));
                UnityEngine.UI.HorizontalLayoutGroup layoutGroup = choice.GetComponent <UnityEngine.UI.HorizontalLayoutGroup> ();

                int choiceId = ii;
                choice.onClick.AddListener(delegate { ChoiceSelected(choiceId); });

                offset -= (choiceText.fontSize + layoutGroup.padding.top + layoutGroup.padding.bottom + elementPadding);
            }
            timer       = 1.0f;
            needChoices = false;
        }
    }
 static int QPYX_SetLayoutVertical_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         UnityEngine.UI.HorizontalLayoutGroup QPYX_obj_YXQP = (UnityEngine.UI.HorizontalLayoutGroup)ToLua.CheckObject <UnityEngine.UI.HorizontalLayoutGroup>(L_YXQP, 1);
         QPYX_obj_YXQP.SetLayoutVertical();
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int CalculateLayoutInputVertical(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.UI.HorizontalLayoutGroup obj = (UnityEngine.UI.HorizontalLayoutGroup)ToLua.CheckObject <UnityEngine.UI.HorizontalLayoutGroup>(L, 1);
         obj.CalculateLayoutInputVertical();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #8
0
 static int SetLayoutVertical(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.UI.HorizontalLayoutGroup obj = (UnityEngine.UI.HorizontalLayoutGroup)ToLua.CheckObject(L, 1, typeof(UnityEngine.UI.HorizontalLayoutGroup));
         obj.SetLayoutVertical();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #9
0
 public override void OnInit(GameObject go)
 {
     base.OnInit(go);
     m_followme_go     = Go.transform.Find("Strategy/m_followme").gameObject;
     m_followme_button = m_followme_go.GetComponent <UnityEngine.UI.Button>();
     m_atk_go          = Go.transform.Find("m_atk").gameObject;
     m_atk_button      = m_atk_go.GetComponent <UnityEngine.UI.Button>();
     m_scrollRect_go   = Go.transform.Find("m_scrollRect").gameObject;
     m_layout_go       = Go.transform.Find("m_scrollRect/m_layout").gameObject;
     m_layout_go.SetActive(false);
     m_layout_horizontallayoutgroup = m_layout_go.GetComponent <UnityEngine.UI.HorizontalLayoutGroup>();
     m_template_cell_go             = Go.transform.Find("m_scrollRect/m_layout/m_template_cell").gameObject;
     m_template_cell_go.SetActive(false);
     m_atk_button.onClick.AddListener(OnAtkBtnClick);
 }
Пример #10
0
    public RichEditLine(Transform parent, float width)
    {
        gameObject = new GameObject("RichEditLine");
        transform = gameObject.AddComponent<RectTransform>();
        transform.SetParent(parent, false);
        transform.SetAsLastSibling();

        layoutElement = gameObject.AddComponent<LayoutElement>();
        layoutElement.preferredWidth = width;
        layoutElement.preferredHeight = 0;

        layoutGroup = gameObject.AddComponent<HorizontalLayoutGroup>();
        layoutGroup.childForceExpandWidth = false;
        layoutGroup.childForceExpandHeight = false;
        layoutGroup.childAlignment = TextAnchor.LowerLeft;
    }
Пример #11
0
    void Update()
    {
        if (storyNeeded == true)
        {
            RemoveChildren();

            float offset = 0;
            while (_inkStory.canContinue)
            {
                storyText      = Instantiate(text);
                storyText.name = "Scroll View";
                _inkStory.ObserveVariable("Char_Image", (string varName, object newValue) => {
                    loadImage((string)newValue);
                });
//				_inkStory.ObserveVariable ("food", (string varName, object newValue) => {
//					 updateFood((int)newValue);
//				});
//				int food = (int)_inkStory.variablesState ["food"];
                storyText.GetComponentInChildren <UnityEngine.UI.Text>().text = _inkStory.ContinueMaximally();
                storyText.transform.SetParent(canvas.transform, false);
                storyText.transform.SetSiblingIndex(1);
            }

            if (_inkStory.currentChoices.Count > 0)
            {
                for (int ii = 0; ii < _inkStory.currentChoices.Count; ++ii)
                {
                    UnityEngine.UI.Button choice = Instantiate(button) as UnityEngine.UI.Button;
                    choice.transform.SetParent(storyText.GetComponentInChildren <Text>().gameObject.transform.parent, false);

                    choice.transform.Translate(new Vector2(0, offset));

                    UnityEngine.UI.Text choiceText = choice.GetComponentInChildren <UnityEngine.UI.Text> ();
                    choiceText.text = _inkStory.currentChoices [ii].text;

                    UnityEngine.UI.HorizontalLayoutGroup layoutGroup = choice.GetComponent <UnityEngine.UI.HorizontalLayoutGroup> ();

                    int choiceId = ii;
                    choice.onClick.AddListener(delegate { ChoiceSelected(choiceId); });

                    offset -= (choiceText.fontSize + layoutGroup.padding.top + layoutGroup.padding.bottom + elementPadding);
                }
            }

            storyNeeded = false;
        }
    }
Пример #12
0
    // Update is called once per frame
    void Update()
    {
        if (storyNeeded == true)
        {
            RemoveChildren();

            float offset = 0;
            while (_inkStory.canContinue)
            {
                UnityEngine.UI.Text storyText = Instantiate(text) as UnityEngine.UI.Text;
                storyText.text = _inkStory.Continue();
                storyText.transform.SetParent(canvas.transform, false);
                storyText.transform.Translate(new Vector2(0, offset));
                offset -= (storyText.fontSize + elementPadding);
            }

            if (_inkStory.currentChoices.Count > 0)
            {
                for (int ii = 0; ii < _inkStory.currentChoices.Count; ++ii)
                {
                    UnityEngine.UI.Button choice = Instantiate(button) as UnityEngine.UI.Button;
                    choice.transform.SetParent(canvas.transform, false);
                    choice.transform.Translate(new Vector2(0, offset));

                    UnityEngine.UI.Text choiceText = choice.GetComponentInChildren <UnityEngine.UI.Text> ();
                    choiceText.text = _inkStory.currentChoices [ii].text;

                    UnityEngine.UI.HorizontalLayoutGroup layoutGroup = choice.GetComponent <UnityEngine.UI.HorizontalLayoutGroup> ();

                    int choiceId = ii;
                    choice.onClick.AddListener(delegate { ChoiceSelected(choiceId); });

                    offset -= (choiceText.fontSize + layoutGroup.padding.top + layoutGroup.padding.bottom + elementPadding);
                }
            }

            storyNeeded = false;
        }
    }
Пример #13
0
        private void Start()
        {
            LayoutGroup = GetComponentInChildren<HorizontalLayoutGroup>();
            UiScripts = GameObject.FindObjectOfType<IngameFunctions>();
            //Achievements = GameObject.FindObjectOfType<AchievementsRecord>();
            Ads = GameObject.FindObjectOfType<FullScreenAds>();
            Dialogs = GameObject.FindObjectOfType<DialogBox>();
            scrollBar = gameObject.GetComponentInChildren<Scrollbar>();

            TotalSize = BasicPalette.Count + 1; //1 for rainbow

            PaletteList = new List<Image>(TotalSize);
            WasColorUsed = new List<bool>(BasicPalette.Count);

            AddColors();

            OnSelectNewColor(1);
        }
Пример #14
0
    public void Startup()
    {
        controller = GameObject.Find ("GameController").GetComponent<GameController> ();
        ingress_call_text = GameObject.Find ("IngressNumber").GetComponent<Text> ();
        egress_call_text = GameObject.Find ("EgressNumber").GetComponent<Text> ();
        dangerous_func_text = GameObject.Find ("TheStrings").GetComponent<Text> ();
        dangerous_func_count_text = GameObject.Find ("interestingFuncNumber").GetComponent<Text> ();
        basic_blks_text = GameObject.Find ("BasicBlocksSelector").GetComponent<Text> ();
        strings_text = GameObject.Find ("AttributeMiddle").GetComponentsInChildren<Text> () [0];
        strings_count_text = GameObject.Find ("stringsNumber").GetComponent<Text> ();
        module_name_text = GameObject.Find ("ModuleName").GetComponent<Text> ();
        func_name_input = GameObject.Find ("longFuncRenameInput").GetComponent<InputField> ();
        func_name_text = GameObject.Find ("LongFuncName").GetComponent<Text> ();
        func_address_text = GameObject.Find ("Address").GetComponent<Text> ();
        func_name_group = GameObject.Find ("LongNamePanel").GetComponent<HorizontalLayoutGroup> ();
        comment_input = GameObject.Find ("NotesInputField").GetComponent<InputField> ();
        mark_input = GameObject.Find ("markInputField").GetComponent<InputField> ();
        marked_scroll_canvas = GameObject.Find ("MarklistContent").GetComponent<Canvas> ();

        InputField.SubmitEvent commentChangeEvent = new InputField.SubmitEvent ();
        commentChangeEvent.AddListener (ChangeComment);
        comment_input.onEndEdit = commentChangeEvent;

        InputField.SubmitEvent functionChangeEvent = new InputField.SubmitEvent ();
        functionChangeEvent.AddListener (ChangeFunctionName);
        func_name_input.onEndEdit = functionChangeEvent;

        InputField.SubmitEvent markChangeEvent = new InputField.SubmitEvent ();
        markChangeEvent.AddListener (ChangeMark);
        mark_input.onEndEdit = markChangeEvent;
    }
Пример #15
0
 void Start()
 {
     rectTransform = gameObject.GetComponent<RectTransform>();
     horizontalLayoutGroup = gameObject.GetComponent<HorizontalLayoutGroup>();
 }
Пример #16
0
 private void CreateLayoutGroup()
 {
     if (isVertical)
     {
         if (isHorizontal)
         {
             grid = contextMenuRT.gameObject.AddComponent<GridLayoutGroup>();
             //type = TYPE_GRID;
             grid.spacing = new Vector2(buttonsSpacingX,buttonsSpacingY);
             grid.padding = new RectOffset(buttonsPaddingX, buttonsPaddingX, buttonsPaddingY, buttonsPaddingY);
             grid.cellSize = new Vector2(buttonsWidth,buttonsHeight);
             return;
         }
         vertical = contextMenuRT.gameObject.AddComponent<VerticalLayoutGroup>();
         //type = TYPE_VERTICAL;
         vertical.spacing = buttonsSpacingY;
         vertical.padding = new RectOffset(buttonsPaddingX, buttonsPaddingX, buttonsPaddingY, buttonsPaddingY);
         vertical.childForceExpandWidth = true;
         vertical.childForceExpandHeight = false;
         return;
     }
     if (isHorizontal)
     {
         horizontal = contextMenuRT.gameObject.AddComponent<HorizontalLayoutGroup>();
         //type = TYPE_HORIZONTAL;
         vertical.spacing = buttonsSpacingX;
         horizontal.padding = new RectOffset(buttonsPaddingX, buttonsPaddingX, buttonsPaddingY, buttonsPaddingY);
         horizontal.childForceExpandWidth = true;
         horizontal.childForceExpandHeight = false;
         return;
     }
 }
Пример #17
0
	protected override void InitLayoutInfo ()
	{
		layout = GetComponentInChildren<HorizontalLayoutGroup> (); 
		layoutRect = layout.GetComponent<RectTransform> (); 
	}
Пример #18
0
 void Awake()
 {
     layoutGroup = GetComponent<HorizontalLayoutGroup>();
 }
Пример #19
0
	void Start () {
        myLayoutGroup = GetComponent<HorizontalLayoutGroup>();
	}
Пример #20
0
        /// <summary>
        /// Creates new line column object.
        /// </summary>
        /// <param name="parent">Parent.</param>
        /// <param name="content">Content.</param>
        /// <param name="isLeft">If set to <c>true</c> is left.</param>
        /// <param name="style">The style.</param>
        private void CreateLineColumn(Transform parent, string content, bool isLeft, UITooltipLines.LineStyle style)
        {
            // Create the game object
            GameObject obj = new GameObject("Column", typeof(RectTransform), typeof(CanvasRenderer));

            obj.layer = this.gameObject.layer;
            obj.transform.SetParent(parent);

            // Set the pivot to top left
            (obj.transform as RectTransform).pivot = new Vector2(0f, 1f);

            // Set a fixed size for attribute columns
            if (style == UITooltipLines.LineStyle.Attribute)
            {
                VerticalLayoutGroup   vlg  = this.gameObject.GetComponent <VerticalLayoutGroup>();
                HorizontalLayoutGroup phlg = parent.gameObject.GetComponent <HorizontalLayoutGroup>();
                LayoutElement         le   = obj.AddComponent <LayoutElement>();
                le.preferredWidth = (this.m_Rect.sizeDelta.x - vlg.padding.horizontal - phlg.padding.horizontal) / 2f;
            }

            // Prepare the text component
            Text text = obj.AddComponent <Text>();

            text.text            = content;
            text.supportRichText = true;
            text.alignment       = (isLeft) ? TextAnchor.LowerLeft : TextAnchor.LowerRight;

            // Prepare some style properties
            TextEffectType effect         = TextEffectType.None;
            Color          effectColor    = Color.white;
            Vector2        effectDistance = new Vector2(1f, -1f);
            bool           effectUseAlpha = true;

            switch (style)
            {
            case UITooltipLines.LineStyle.Title:
                text.font        = this.m_TitleFont;
                text.fontStyle   = this.m_TitleFontStyle;
                text.fontSize    = this.m_TitleFontSize;
                text.lineSpacing = this.m_TitleFontLineSpacing;
                text.color       = this.m_TitleFontColor;
                effect           = this.m_TitleTextEffect;
                effectColor      = this.m_TitleTextEffectColor;
                effectDistance   = this.m_TitleTextEffectDistance;
                effectUseAlpha   = this.m_TitleTextEffectUseGraphicAlpha;
                break;

            case UITooltipLines.LineStyle.Attribute:
                text.font        = this.m_AttributeFont;
                text.fontStyle   = this.m_AttributeFontStyle;
                text.fontSize    = this.m_AttributeFontSize;
                text.lineSpacing = this.m_AttributeFontLineSpacing;
                text.color       = this.m_AttributeFontColor;
                effect           = this.m_AttributeTextEffect;
                effectColor      = this.m_AttributeTextEffectColor;
                effectDistance   = this.m_AttributeTextEffectDistance;
                effectUseAlpha   = this.m_AttributeTextEffectUseGraphicAlpha;
                break;

            case UITooltipLines.LineStyle.Description:
                text.font        = this.m_DescriptionFont;
                text.fontStyle   = this.m_DescriptionFontStyle;
                text.fontSize    = this.m_DescriptionFontSize;
                text.lineSpacing = this.m_DescriptionFontLineSpacing;
                text.color       = this.m_DescriptionFontColor;
                effect           = this.m_DescriptionTextEffect;
                effectColor      = this.m_DescriptionTextEffectColor;
                effectDistance   = this.m_DescriptionTextEffectDistance;
                effectUseAlpha   = this.m_DescriptionTextEffectUseGraphicAlpha;
                break;
            }

            // Add text effect component
            if (effect == TextEffectType.Shadow)
            {
                Shadow s = obj.AddComponent <Shadow>();
                s.effectColor     = effectColor;
                s.effectDistance  = effectDistance;
                s.useGraphicAlpha = effectUseAlpha;
            }
            else if (effect == TextEffectType.Outline)
            {
                Outline o = obj.AddComponent <Outline>();
                o.effectColor     = effectColor;
                o.effectDistance  = effectDistance;
                o.useGraphicAlpha = effectUseAlpha;
            }
        }
Пример #21
0
    public void Generate(GameObject currSimon)
    {
        pushSimonColor(Random.Range(0, MAX_INDEX));
        currSimon.transform.FindChild("NewLetter").GetComponent<SpriteRenderer>().sprite = LastSprite;

        progressSlider = currSimon.GetComponentInChildren<Slider>();
        recordContent = currSimon.GetComponentInChildren<HorizontalLayoutGroup>();
    }