void IDragHandler.OnDrag(PointerEventData eventData)
 {
     if (Object.op_Inequality((Object)this.Parent, (Object)null) && Object.op_Inequality((Object)this.SecondaryTarget, (Object)null))
     {
         if ((double)this.XSign != 0.0)
         {
             float  num1 = this.m_midX + (float)eventData.get_delta().x *(float)Math.Sign(this.XSign);
             double num2 = (double)num1;
             Rect   rect = this.Parent.get_rect();
             double num3 = (double)((Rect) ref rect).get_width() - (double)this.Target.get_minWidth() - (double)this.SecondaryTarget.get_minWidth();
             float  num4 = (float)(num2 / num3);
             this.Target.set_flexibleWidth(num4);
             this.SecondaryTarget.set_flexibleWidth(1f - num4);
             this.m_midX = num1;
         }
         if ((double)this.YSign != 0.0)
         {
             float  num1 = this.m_midY + (float)eventData.get_delta().y *(float)Math.Sign(this.YSign);
             double num2 = (double)num1;
             Rect   rect = this.Parent.get_rect();
             double num3 = (double)((Rect) ref rect).get_height() - (double)this.Target.get_minHeight() - (double)this.SecondaryTarget.get_minHeight();
             float  num4 = (float)(num2 / num3);
             this.Target.set_flexibleHeight(num4);
             this.SecondaryTarget.set_flexibleHeight(1f - num4);
             this.m_midY = num1;
         }
         if ((double)this.XSign != 0.0)
         {
             this.Target.set_flexibleWidth(Mathf.Clamp01(this.Target.get_flexibleWidth()));
             this.SecondaryTarget.set_flexibleWidth(Mathf.Clamp01(this.SecondaryTarget.get_flexibleWidth()));
         }
         if ((double)this.YSign == 0.0)
         {
             return;
         }
         this.Target.set_flexibleHeight(Mathf.Clamp01(this.Target.get_flexibleHeight()));
         this.SecondaryTarget.set_flexibleHeight(Mathf.Clamp01(this.SecondaryTarget.get_flexibleHeight()));
     }
     else
     {
         if ((double)this.XSign != 0.0)
         {
             LayoutElement target = this.Target;
             target.set_preferredWidth(target.get_preferredWidth() + (float)eventData.get_delta().x *(float)Math.Sign(this.XSign));
             if (this.HasMaxSize && (double)this.Target.get_preferredWidth() > (double)this.MaxSize)
             {
                 this.Target.set_preferredWidth(this.MaxSize);
             }
         }
         if ((double)this.YSign == 0.0)
         {
             return;
         }
         LayoutElement target1 = this.Target;
         target1.set_preferredHeight(target1.get_preferredHeight() + (float)eventData.get_delta().y *(float)Math.Sign(this.YSign));
         if (!this.HasMaxSize || (double)this.Target.get_preferredHeight() <= (double)this.MaxSize)
         {
             return;
         }
         this.Target.set_preferredHeight(this.MaxSize);
     }
 }
Exemplo n.º 2
0
    protected virtual void Update()
    {
        CUIFormScript formGuideMask = NewbieGuideScriptControl.FormGuideMask;

        if (NewbieGuideBaseScript.ms_originalForm != null && formGuideMask != null)
        {
            int count = NewbieGuideBaseScript.ms_highlitGo.get_Count();
            DebugHelper.Assert(count <= NewbieGuideBaseScript.ms_originalGo.get_Count());
            for (int i = 0; i < count; i++)
            {
                GameObject gameObject  = NewbieGuideBaseScript.ms_highlitGo.get_Item(i);
                GameObject gameObject2 = NewbieGuideBaseScript.ms_originalGo.get_Item(i);
                GameObject gameObject3 = null;
                if (NewbieGuideBaseScript.ms_highlighter.get_Count() > i)
                {
                    gameObject3 = NewbieGuideBaseScript.ms_highlighter.get_Item(i);
                }
                if (!(gameObject == null) && !(gameObject2 == null))
                {
                    gameObject.CustomSetActive(gameObject2.activeSelf);
                    Image component  = gameObject2.GetComponent <Image>();
                    Image component2 = gameObject.GetComponent <Image>();
                    if (component != null && component2 != null)
                    {
                        component2.set_color(component.get_color());
                    }
                    RectTransform rectTransform  = gameObject.transform as RectTransform;
                    RectTransform rectTransform2 = gameObject2.transform as RectTransform;
                    rectTransform.localScale = rectTransform2.localScale;
                    rectTransform.pivot      = rectTransform2.pivot;
                    rectTransform.sizeDelta  = rectTransform2.sizeDelta;
                    LayoutElement component3 = rectTransform2.GetComponent <LayoutElement>();
                    if (component3 != null && rectTransform.sizeDelta == Vector2.zero)
                    {
                        rectTransform.sizeDelta = new Vector2(component3.get_preferredWidth(), component3.get_preferredHeight());
                    }
                    rectTransform.position = rectTransform2.position;
                    Vector2 screenPoint = CUIUtility.WorldToScreenPoint(NewbieGuideBaseScript.ms_originalForm.GetCamera(), rectTransform2.position);
                    Vector3 vector      = CUIUtility.ScreenToWorldPoint(NewbieGuideScriptControl.FormGuideMask.GetCamera(), screenPoint, rectTransform.position.z);
                    if (i < NewbieGuideBaseScript.ms_guideTextList.get_Count())
                    {
                        NewbieGuideSpecialTipConf specialTipConfig = Singleton <NewbieGuideDataManager> .GetInstance().GetSpecialTipConfig((uint)this.currentConf.wSpecialTip);

                        if (specialTipConfig != null && specialTipConfig.bGuideTextPos > 0)
                        {
                            if (gameObject3 != null)
                            {
                                NewbieGuideBaseScript.ms_guideTextList.get_Item(i).CustomSetActive(gameObject3.activeSelf);
                            }
                            NewbieGuideBaseScript.UpdateGuideTextPos(specialTipConfig, gameObject2, formGuideMask, NewbieGuideBaseScript.ms_originalForm, NewbieGuideBaseScript.ms_guideTextList.get_Item(i));
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
        public void CreateMainWindow(int MenuID)
        {
            string s = LocalizedText.Get("help.MENU_NUM");

            if (s == null)
            {
                return;
            }
            int num1 = int.Parse(s);

            if (MenuID < 0 || MenuID >= num1 || Object.op_Equality((Object)this.m_HelpMain, (Object)null))
            {
                return;
            }
            int       num2   = MenuID + 1;
            float     num3   = 0.0f;
            Transform child1 = this.m_HelpMain.get_transform().FindChild("header");

            if (Object.op_Inequality((Object)child1, (Object)null))
            {
                LText  component = (LText)((Component)child1.FindChild("Text")).GetComponent <LText>();
                string str       = LocalizedText.Get("help.MAIN_TITLE_" + (object)num2);
                if (string.IsNullOrEmpty(str) || str == "MAIN_TITLE_" + (object)num2)
                {
                    ((Component)child1).get_gameObject().SetActive(false);
                }
                else
                {
                    component.set_text(str);
                }
            }
            Transform image1 = this.m_HelpMain.get_transform().Find("page/template/contents/viewport/layout/contents_image");

            if (this.SetImageData(image1, "Image", "Helps/help_image_" + (object)num2))
            {
                LayoutElement component = (LayoutElement)((Component)image1).GetComponent <LayoutElement>();
                num3 += component.get_minHeight();
            }
            bool      flag   = false;
            Transform image2 = this.m_HelpMain.get_transform().Find("page/template/contents/viewport/layout/contents_image_small");

            if (flag | this.SetImageData(image2, "Image0", "Helps/help_image_" + (object)num2 + "_0") | this.SetImageData(image2, "Image1", "Helps/help_image_" + (object)num2 + "_1"))
            {
                ((Component)image2).get_gameObject().SetActive(true);
                LayoutElement component = (LayoutElement)((Component)image2).GetComponent <LayoutElement>();
                num3 += component.get_minHeight();
            }
            Transform child2 = this.m_HelpMain.get_transform().FindChild("page/template/contents/viewport/layout/contents_text");

            if (Object.op_Inequality((Object)child2, (Object)null))
            {
                Transform     child3     = child2.FindChild("Text");
                LText         component1 = (LText)((Component)child3).GetComponent <LText>();
                string        str1       = LocalizedText.Get("help.MAIN_TEXT_" + (object)num2);
                string        str2       = "help.MAIN_TEXT_" + (object)num2;
                LayoutElement component2 = (LayoutElement)((Component)child2).GetComponent <LayoutElement>();
                if (string.IsNullOrEmpty(str1) || str1 == "MAIN_TEXT_" + (object)num2)
                {
                    ((Component)child2).get_gameObject().SetActive(false);
                }
                else
                {
                    component1.set_text(str2);
                    ((Component)child2).get_gameObject().SetActive(true);
                    num3 += component2.get_preferredHeight();
                    HelpWindow.HELP_ID helpId           = (HelpWindow.HELP_ID)num2;
                    RectTransform      component3       = (RectTransform)((Component)child3).GetComponent <RectTransform>();
                    Vector2            anchoredPosition = component3.get_anchoredPosition();
                    switch (helpId)
                    {
                    case HelpWindow.HELP_ID.ACTION:
                        anchoredPosition.y = (__Null)150.0;
                        component3.set_anchoredPosition(anchoredPosition);
                        num3 -= component2.get_preferredHeight();
                        break;

                    case HelpWindow.HELP_ID.REACTION:
                    case HelpWindow.HELP_ID.SUPPORT:
                        anchoredPosition.y = (__Null)250.0;
                        component3.set_anchoredPosition(anchoredPosition);
                        num3 = component2.get_preferredHeight();
                        break;

                    case HelpWindow.HELP_ID.SHOP:
                        anchoredPosition.y = (__Null)200.0;
                        component3.set_anchoredPosition(anchoredPosition);
                        num3 -= component2.get_preferredHeight();
                        break;

                    default:
                        anchoredPosition.y = (__Null)0.0;
                        component3.set_anchoredPosition(anchoredPosition);
                        break;
                    }
                }
            }
            RectTransform child4            = this.m_HelpMain.get_transform().FindChild("page/template/contents/viewport/layout") as RectTransform;
            Vector2       anchoredPosition1 = child4.get_anchoredPosition();
            Vector2       sizeDelta         = child4.get_sizeDelta();

            sizeDelta.y = (__Null)(double)num3;
            child4.set_sizeDelta(sizeDelta);
            anchoredPosition1.y = (__Null)0.0;
            child4.set_anchoredPosition(anchoredPosition1);
            this.m_HelpMain.SetActive(true);
            if (Object.op_Implicit((Object)this.MiddleBackButton))
            {
                ((Component)this.MiddleBackButton).get_gameObject().SetActive(false);
            }
            ((Component)this.BackButton).get_gameObject().SetActive(true);
        }
Exemplo n.º 4
0
    private void AddHighlightInternal(GameObject baseGo, CUIFormScript inOriginalForm, bool cloneEvent, bool bShowFinger)
    {
        this.PreHighlight();
        if (baseGo != null)
        {
            NewbieGuideBaseScript.ms_originalGo.Add(baseGo);
        }
        NewbieGuideBaseScript.ms_originalForm = inOriginalForm;
        this.OpenGuideForm();
        if (NewbieGuideScriptControl.FormGuideMask == null)
        {
            NewbieGuideScriptControl.OpenGuideForm();
        }
        List <GameObject> .Enumerator enumerator = NewbieGuideBaseScript.ms_originalGo.GetEnumerator();
        int num = 0;

        while (enumerator.MoveNext())
        {
            GameObject current = enumerator.get_Current();
            if (!(current == null))
            {
                GameObject gameObject = Object.Instantiate(current) as GameObject;
                if (!(gameObject == null))
                {
                    RectTransform rectTransform = gameObject.transform as RectTransform;
                    rectTransform.SetParent(NewbieGuideScriptControl.FormGuideMask.transform);
                    rectTransform.SetSiblingIndex(1);
                    rectTransform.localScale = current.transform.localScale;
                    RectTransform rectTransform2 = current.transform as RectTransform;
                    rectTransform.pivot     = rectTransform2.pivot;
                    rectTransform.sizeDelta = rectTransform2.sizeDelta;
                    LayoutElement component = current.GetComponent <LayoutElement>();
                    if (component != null && rectTransform.sizeDelta == Vector2.zero)
                    {
                        rectTransform.sizeDelta = new Vector2(component.get_preferredWidth(), component.get_preferredHeight());
                    }
                    rectTransform.position = current.transform.position;
                    Vector2 screenPoint   = CUIUtility.WorldToScreenPoint(inOriginalForm.GetCamera(), current.transform.position);
                    Vector3 worldPosition = CUIUtility.ScreenToWorldPoint(NewbieGuideScriptControl.FormGuideMask.GetCamera(), screenPoint, rectTransform.position.z);
                    NewbieGuideScriptControl.FormGuideMask.InitializeWidgetPosition(gameObject, worldPosition);
                    gameObject.CustomSetActive(false);
                    if (cloneEvent)
                    {
                        CUIEventScript component2 = current.GetComponent <CUIEventScript>();
                        CUIEventScript component3 = gameObject.GetComponent <CUIEventScript>();
                        if (component2 && component3)
                        {
                            component3.m_onDownEventParams      = component2.m_onDownEventParams;
                            component3.m_onUpEventParams        = component2.m_onUpEventParams;
                            component3.m_onClickEventParams     = component2.m_onClickEventParams;
                            component3.m_onHoldStartEventParams = component2.m_onHoldStartEventParams;
                            component3.m_onHoldEventParams      = component2.m_onHoldEventParams;
                            component3.m_onHoldEndEventParams   = component2.m_onHoldEndEventParams;
                            component3.m_onDragStartEventParams = component2.m_onDragStartEventParams;
                            component3.m_onDragEventParams      = component2.m_onDragEventParams;
                            component3.m_onDragEndEventParams   = component2.m_onDragEndEventParams;
                            component3.m_onDropEventParams      = component2.m_onDropEventParams;
                            component3.m_closeFormWhenClicked   = component2.m_closeFormWhenClicked;
                            component3.m_belongedFormScript     = component2.m_belongedFormScript;
                            component3.m_belongedListScript     = component2.m_belongedListScript;
                            component3.m_indexInlist            = component2.m_indexInlist;
                        }
                        CUIMiniEventScript component4 = current.GetComponent <CUIMiniEventScript>();
                        CUIMiniEventScript component5 = gameObject.GetComponent <CUIMiniEventScript>();
                        if (component4 && component5)
                        {
                            component5.m_onDownEventParams    = component4.m_onDownEventParams;
                            component5.m_onUpEventParams      = component4.m_onUpEventParams;
                            component5.m_onClickEventParams   = component4.m_onClickEventParams;
                            component5.m_closeFormWhenClicked = component4.m_closeFormWhenClicked;
                            component5.m_belongedFormScript   = component4.m_belongedFormScript;
                            component5.m_belongedListScript   = component4.m_belongedListScript;
                            component5.m_indexInlist          = component4.m_indexInlist;
                        }
                    }
                    else
                    {
                        CUIEventScript component6 = gameObject.GetComponent <CUIEventScript>();
                        if (component6)
                        {
                            component6.enabled = false;
                        }
                        CUIMiniEventScript component7 = gameObject.GetComponent <CUIMiniEventScript>();
                        if (component7)
                        {
                            component7.enabled = false;
                        }
                    }
                    gameObject.CustomSetActive(true);
                    CUIAnimatorScript component8 = current.GetComponent <CUIAnimatorScript>();
                    if (component8 != null)
                    {
                        CUICommonSystem.PlayAnimator(gameObject, component8.m_currentAnimatorStateName);
                    }
                    NewbieGuideBaseScript.ms_highlitGo.Add(gameObject);
                    if (bShowFinger)
                    {
                        GameObject gameObject2 = Singleton <CResourceManager> .GetInstance().GetResource("UGUI/Form/System/Dialog/WeakGuideHighlighter.prefab", typeof(GameObject), enResourceType.UIPrefab, false, false).m_content as GameObject;

                        if (gameObject2 != null)
                        {
                            GameObject gameObject3 = Object.Instantiate(gameObject2) as GameObject;
                            if (gameObject3 != null)
                            {
                                gameObject3.transform.SetParent(gameObject.transform);
                                Transform transform = gameObject3.transform;
                                switch (this.currentConf.wFlipType)
                                {
                                case 0:
                                    transform.localScale = NewbieGuideBaseScript.s_FlipNone;
                                    break;

                                case 1:
                                    transform.localScale = NewbieGuideBaseScript.s_FlipX;
                                    break;

                                case 2:
                                    transform.localScale = NewbieGuideBaseScript.s_FlipY;
                                    break;

                                case 3:
                                    transform.localScale = NewbieGuideBaseScript.s_FlipXY;
                                    break;
                                }
                                gameObject3.transform.position = gameObject.transform.position;
                                (gameObject3.transform as RectTransform).anchoredPosition = new Vector2((float)this.currentConf.iOffsetHighLightX, (float)this.currentConf.iOffsetHighLightY);
                                if (!this.DoesShowArrow())
                                {
                                    gameObject3.transform.FindChild("Panel/ImageFinger").gameObject.CustomSetActive(false);
                                }
                                NewbieGuideBaseScript.ms_highlighter.Add(gameObject3);
                            }
                        }
                    }
                    if (num == 0 && this.currentConf.wSpecialTip != 0)
                    {
                        NewbieGuideSpecialTipConf specialTipConfig = Singleton <NewbieGuideDataManager> .GetInstance().GetSpecialTipConfig((uint)this.currentConf.wSpecialTip);

                        if (specialTipConfig != null && specialTipConfig.bGuideTextPos > 0)
                        {
                            GameObject gameObject4 = NewbieGuideBaseScript.InstantiateGuideText(specialTipConfig, gameObject, NewbieGuideScriptControl.FormGuideMask, inOriginalForm);
                            if (gameObject4 != null)
                            {
                                NewbieGuideBaseScript.ms_guideTextList.Add(gameObject4);
                                gameObject4.CustomSetActive(false);
                            }
                        }
                    }
                    num++;
                }
            }
        }
    }