Exemplo n.º 1
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));
                        }
                    }
                }
            }
        }
    }
 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.º 3
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++;
                }
            }
        }
    }