Exemple #1
0
        public virtual IUIUpdate UF_GenUI(string spUpdateKey, bool firstSibling)
        {
            IUIUpdate ui = null;

            if (string.IsNullOrEmpty(m_PrefabUI))
            {
                Debugger.UF_Error(string.Format("[{0}] -> GenItem Failed,uiName is null", this.name));
            }
            else
            {
                ui = UIManager.UF_GetInstance().UF_CreateItem(m_PrefabUI);
                if (ui != null)
                {
                    if (string.IsNullOrEmpty(spUpdateKey))
                    {
                        ui.updateKey = this.rectTransform.childCount.ToString();
                    }
                    else
                    {
                        ui.updateKey = spUpdateKey;
                    }
                    this.UF_AddUI(ui, firstSibling);
                }
                else
                {
                    Debugger.UF_Error(string.Format("[{0}] -> Can not Load uiName[{0}]", m_PrefabUI));
                }
            }
            return(ui);
        }
Exemple #2
0
 public override void UF_AddUI(IUIUpdate ui, bool firstSibling)
 {
     base.UF_AddUI(ui, firstSibling);
     ui.rectTransform.anchorMin = this.rectTransform.pivot;
     ui.rectTransform.anchorMax = this.rectTransform.pivot;
     mapTransToUI.Add(ui.rectTransform.transform, ui);
 }
Exemple #3
0
 //生成飘字
 public void UF_AddFloat(IUIUpdate ui)
 {
     if (ui != null)
     {
         ui.rectTransform.SetParent(this.transform);
         ui.rectTransform.localPosition = Vector3.zero;
         ui.rectTransform.localScale    = Vector3.one;
         //重新计算各个飘字浮动位置
         FloatObject floatword = UF_CreateFloat();
         floatword.progress = 0;
         floatword.life     = decayTime;
         floatword.ui       = ui;
         if (mListFloat.Count > 0)
         {
             mListFloat.Add(default(FloatObject));
             for (int k = mListFloat.Count - 1; k > 0; k--)
             {
                 mListFloat [k] = mListFloat [k - 1];
                 Vector3 directPos = mListFloat [k].directPos;
                 mListFloat [k].progress  = 0;
                 mListFloat [k].directPos = new Vector3(directPos.x, directPos.y + space, directPos.z);
                 mListFloat [k].sourcePos = mListFloat [k].ui.rectTransform.localPosition;
             }
             mListFloat [0] = floatword;
         }
         else
         {
             mListFloat.Add(floatword);
         }
     }
 }
Exemple #4
0
 private void UF_MapStaticUIElement()
 {
     if (m_ListUpdateUI != null)
     {
         for (int k = 0; k < m_ListUpdateUI.Count; k++)
         {
             IUIUpdate iuiupdate = m_ListUpdateUI[k] as IUIUpdate;
             if (iuiupdate != null)
             {
                 //init static map
                 if (!MapStaticUI.ContainsKey(iuiupdate.updateKey))
                 {
                     MapStaticUI.Add(iuiupdate.updateKey, iuiupdate);
                 }
                 else
                 {
                     if (Debugger.IsActive)
                     {
                         Debugger.UF_Warn(string.Format("Same Update Key [{0}] in UI[{1}]", this.name, iuiupdate.updateKey));
                     }
                 }
             }
         }
     }
 }
Exemple #5
0
        //移除元素会重新刷新列表全部显示的UI
        public void UF_RemoveUIBaseIndex(int index)
        {
            if (index > m_TotalCount || index < 0)
            {
                return;
            }

            m_TotalCount--;

            if (index < m_ReposIndex)
            {
                m_ReposIndex--;
            }
            else if (index >= m_ReposIndex && index < m_ReposIndex + m_MaxShowCount)
            {
                int       childIdx = index - m_ReposIndex;
                IUIUpdate ui       = UF_GetUIAtChildIndex(childIdx);
                if (m_ReposIndex + m_MaxShowCount > m_TotalCount)
                {
                    base.UF_RemoveUI(ui.updateKey);
                }
                else
                {
                    ui.rectTransform.SetAsLastSibling();
                    UF_OnUIReposition(ui, index, m_ReposIndex + m_MaxShowCount);
                }
            }
            this.UF_SetDirty();
        }
 static int UF_set_ui(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         bool           ret    = false;
         IUIUpdateGroup target = (IUIUpdateGroup)ToLua.CheckObject(L, 1, typeof(IUIUpdateGroup));
         if (target != null)
         {
             string    key = LuaDLL.lua_tostring(L, 2);
             IUIUpdate ui  = target.UF_GetUI(key);
             if (ui != null)
             {
                 ret = true;
                 //判断是否真实是bool 值,去除nil
                 if (LuaDLL.lua_isrboolean(L, 3))
                 {
                     bool active = LuaDLL.lua_toboolean(L, 3);
                     ui.UF_SetActive(active);
                 }
                 else
                 {
                     object value = ToLua.ToVarObject(L, 3);
                     ui.UF_SetValue(value);
                 }
             }
         }
         LuaDLL.lua_pushboolean(L, ret);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #7
0
 //ui 位置循环重置
 protected void UF_OnUIReposition(IUIUpdate ui, int curIndex, int lastIndex)
 {
     if (m_MethodUIRespositon != null)
     {
         m_MethodUIRespositon(ui, curIndex, lastIndex);
     }
 }
Exemple #8
0
 public void UF_Add(IUIUpdate target)
 {
     if (target != null)
     {
         m_Targets.Add((MonoBehaviour)target);
     }
 }
Exemple #9
0
 public override void UF_AddUI(IUIUpdate ui, bool firstSibling)
 {
     base.UF_AddUI(ui, firstSibling);
     if (m_FixedCellSize)
     {
         ui.rectTransform.sizeDelta = m_CellSize;
     }
     this.UF_SetDirty();
 }
Exemple #10
0
        void UF_UpdateHorizontal()
        {
            float posVal    = this.anchoredPosition.x;
            float cellVal   = this.m_CellSize.x;
            float spaceVal  = this.m_Space.x;
            float cellSpace = cellVal + spaceVal;

            if (System.Math.Abs(m_CurPosVal - posVal) > 0.01f && this.needReposition)
            {
                int delta = (int)(posVal - m_SourcePosVal);
                if (delta < 0)
                {
                    while (delta < 0 && Mathf.Abs(delta) > cellSpace && (m_ReposIndex + m_MaxShowCount) < m_TotalCount)
                    {
                        m_SourcePosVal -= cellSpace;
                        for (int k = 0; k < m_Constraint; k++)
                        {
                            //记录UI 位置的变化,后续更新位置
                            IUIUpdate ui = this.UF_GetUIAtFirst();
                            UF_AddIdxChangedBuffer(ui, m_ReposIndex + m_MaxShowCount, m_ReposIndex);
                            ui.rectTransform.SetAsLastSibling();
                            m_ReposIndex++;
                            if (m_ReposIndex + m_MaxShowCount == m_TotalCount)
                            {
                                break;
                            }
                        }
                        //loop
                        delta = (int)(posVal - m_SourcePosVal);
                    }
                }
                else
                {
                    while (delta > 0 && delta > spaceVal && m_ReposIndex > 0)
                    {
                        m_SourcePosVal += cellSpace;
                        for (int k = 1; k <= m_Constraint; k++)
                        {
                            m_ReposIndex--;
                            IUIUpdate ui = this.UF_GetUIAtLast();
                            ui.rectTransform.SetAsFirstSibling();
                            UF_AddIdxChangedBuffer(ui, m_ReposIndex, m_ReposIndex + m_MaxShowCount);
                            if (m_ReposIndex == 0)
                            {
                                break;
                            }
                        }
                        //loop
                        delta = (int)(posVal - m_SourcePosVal);
                    }
                }
            }
            else
            {
                m_CurPosVal = posVal;
            }
        }
Exemple #11
0
        public Vector2 UF_GetUIPosInRoot(IUIUpdate iui)
        {
            MonoBehaviour mb = iui as MonoBehaviour;

            if (mb != null)
            {
                return(UF_GetPosInRoot(mb.transform.position));
            }
            return(Vector2.zero);
        }
        internal PlayerControl(string source, Window window, IUIUpdate loadingUpdater = null, bool usePlayready = false)
        {
            uriSource   = source;
            this.window = window;
            player      = new Tizen.TV.Multimedia.Player();
            player.SetSource(new MediaUriSource(uriSource));

            player.Display            = new Display(window);
            player.PlaybackCompleted += (s, _) =>
            {
                player.Stop();
                Unprepare();
            };
            player.PlaybackInterrupted += (s, _) =>
            {
                Tizen.Log.Info("KEY", "Interrupted");
                interruptedPosition = player.GetPlayPosition();
                Unprepare();
            };
            player.ErrorOccurred += (s, e) =>
            {
                Tizen.Log.Info("KEY", e.ToString());
            };

            if (loadingUpdater != null)
            {
                this.loadingUpdater              = loadingUpdater;
                player.BufferingProgressChanged += BufferingHandler;
            }
            if (usePlayready)
            {
                try
                {
                    drm = DRMManager.CreateDRMManager(DRMType.Playready);
                    drm.AddProperty("LicenseServer", licenseServer);
                    drm.AddProperty("DeleteLicenseAfterUse", true);
                    drm.AddProperty("GetChallenge", true);
                }
                catch (ArgumentException e)
                {
                    if (drm != null)
                    {
                        drm.Dispose();
                    }
                    MessageBox.New(e.ToString());
                }
                catch (PlatformNotSupportedException e)
                {
                    MessageBox.New(e.ToString());
                }
            }
        }
Exemple #13
0
        public Vector2 UF_GetUIPosition(string key)
        {
            IUIUpdate ui = this.UF_GetUI(key) as IUIUpdate;

            if (ui != null)
            {
                return(ui.rectTransform.anchoredPosition);
            }
            else
            {
                return(Vector2.zero);
            }
        }
Exemple #14
0
    public static void DrawUIUpdatable(IUIUpdate uiupdatable)
    {
        if (uiupdatable == null)
        {
            return;
        }

        string ukey = EditorGUILayout.TextField("更新健", uiupdatable.updateKey);

        if (GUI.changed)
        {
            uiupdatable.updateKey = ukey;
        }
    }
Exemple #15
0
        public bool UF_SetKActive(string key, bool value)
        {
            IUIUpdate ui = this.UF_GetUI(key) as IUIUpdate;

            if (ui != null)
            {
                ui.UF_SetActive(value);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #16
0
        private void UF_AddIdxChangedBuffer(IUIUpdate ui, int curIndex, int lastIndex)
        {
            UIIndexChanged buffer = new UIIndexChanged();

            buffer.curIndex  = curIndex;
            buffer.lastIndex = lastIndex;
            if (mapIndexChangedBuffer.ContainsKey(ui))
            {
                mapIndexChangedBuffer [ui] = buffer;
            }
            else
            {
                mapIndexChangedBuffer.Add(ui, buffer);
            }
        }
Exemple #17
0
 //只能移除动态类型
 public virtual void UF_RemoveUI(string key)
 {
     if (MapDynamicUI.ContainsKey(key))
     {
         IUIUpdate ui = MapDynamicUI [key];
         if (ui is IReleasable)
         {
             (ui as IReleasable).Release();
         }
         else if (ui is IOnReset)
         {
             (ui as IOnReset).UF_OnReset();
         }
         MapDynamicUI.Remove(key);
     }
 }
Exemple #18
0
        public override IUIUpdate UF_GenUI(string spUpdateKey, bool firstSibling)
        {
            IUIUpdate ui = null;

            if (string.IsNullOrEmpty(m_PrefabUI))
            {
                Debugger.UF_Error(string.Format("[{0}] -> GenUI Failed,itemName is null", this.name));
                return(null);
            }
            if (m_TotalCount < m_MaxShowCount)
            {
                ui = base.UF_GenUI(spUpdateKey, firstSibling);
            }
            m_TotalCount++;
            return(ui);
        }
Exemple #19
0
 public void Reset()
 {
     if (ui != null)
     {
         if (ui is IReleasable)
         {
             (ui as IReleasable).Release();
         }
         else if (ui is IOnReset)
         {
             (ui as IOnReset).UF_OnReset();
         }
     }
     ui        = null;
     progress  = 0;
     sourcePos = Vector3.zero;
     directPos = Vector3.zero;
 }
Exemple #20
0
    public static void DrawUpdateKeyTextField(IUIUpdate ui)
    {
        if (!(ui is Object))
        {
            return;
        }
        Color oldColor = GUI.color;

        GUI.color = new Color(0.8f, 1f, 0.8f, 1);
        GUILayout.Space(5);
        string updateKey = EditorGUILayout.TextField("更新健", ui.updateKey);

        GUILayout.Space(5);
        GUI.color = oldColor;
        if (GUI.changed)
        {
            EditorTools.RegisterUndo(ui.GetType().ToString(), ui as Object);
            ui.updateKey = updateKey;
            EditorTools.SetDirty(ui as Object);
        }
    }
Exemple #21
0
        //只能更改动态加入的UI UpdateKey
        public bool UF_ChangeUIUpdateKey(string source, string target)
        {
            IUIUpdate ui = this.UF_GetDynamicUI(source);

            if (ui == null)
            {
                Debugger.UF_Warn(string.Format("Change UI UpdateKey Failed,Can not find UI[{0}] in Dynamic", source ?? ""));
                return(false);
            }
            else if (MapDynamicUI.ContainsKey(target))
            {
                Debugger.UF_Warn(string.Format("Change UI UpdateKey Failed,Same UI UpdateKey{0}] Has Exist", target ?? ""));
                return(false);
            }
            ui.updateKey = target;
            //移除原有Key
            MapDynamicUI.Remove(source);
            //添加新key
            MapDynamicUI.Add(target, ui);
            return(true);
        }
Exemple #22
0
 public void UF_Switch(string key)
 {
     if (m_SourceCount == 0)
     {
         m_SourceCount = m_Targets.Count;
     }
     if (m_Targets != null && m_Targets.Count > 0)
     {
         IUIUpdate handle = null;
         foreach (MonoBehaviour target in m_Targets)
         {
             if (target != null)
             {
                 handle = target as IUIUpdate;
                 if (handle != null)
                 {
                     handle.UF_SetActive(handle.updateKey == key);
                 }
             }
         }
     }
 }
Exemple #23
0
        public override IUIUpdate UF_GenUI(string spUpdateKey, bool firstSibling)
        {
            if (m_QueueUI.Count > m_FixedCount)
            {
                IUIUpdate ui = m_QueueUI.Dequeue();
                if (ui != null)
                {
                    if (ui is IOnReset)
                    {
                        (ui as IOnReset).UF_OnReset();
                    }
                    if (!string.IsNullOrEmpty(spUpdateKey))
                    {
                        this.UF_ChangeUIUpdateKey(ui.updateKey, spUpdateKey);
                    }
                    //this.AddUI(ui, firstSibling);
                    m_QueueUI.Enqueue(ui);
                    if (firstSibling)
                    {
                        (ui as MonoBehaviour).transform.SetAsFirstSibling();
                    }
                    else
                    {
                        (ui as MonoBehaviour).transform.SetAsLastSibling();
                    }

                    UF_SetDirty();
                    return(ui);
                }
                else
                {
                    Debugger.UF_Error(string.Format("The UI[{0}] Can not Access in this Grid,Check if has been Destroyed!", m_PrefabUI));
                }
            }
            return(base.UF_GenUI(spUpdateKey, firstSibling));
        }
Exemple #24
0
 public virtual void UF_AddUI(IUIUpdate ui, bool firstSibling)
 {
     if (ui != null)
     {
         if (!string.IsNullOrEmpty(ui.updateKey) && !MapDynamicUI.ContainsKey(ui.updateKey))
         {
             MapDynamicUI.Add(ui.updateKey, ui);
         }
         else
         {
             //如果没有或有重复UpdateKey ,则使用InstanceID 来代替
             int insID = ((Object)ui).GetInstanceID();
             MapDynamicUI.Add(insID.ToString(), ui);
             Debugger.UF_Warn(string.Format("UI Update Key[{0}] Is Same Or Empty,Map With Instance ID:{1}", ui.updateKey ?? "", insID));
         }
         GameObject uiobject = (ui as MonoBehaviour).gameObject;
         uiobject.transform.SetParent(this.transform, false);
         uiobject.transform.localScale = Vector3.one;
         if (firstSibling)
         {
             uiobject.transform.SetAsFirstSibling();
         }
     }
 }
Exemple #25
0
 protected override void OnRebuildLoyout()
 {
     if (Application.isPlaying)
     {
         //更新元素布局位置
         int count = this.childCount;
         int idx   = 0;
         for (int k = 0; k < count; k++)
         {
             IUIUpdate ui = UF_GetUIAtChildIndex(k);
             if (ui == null)
             {
                 continue;
             }
             ui.rectTransform.anchoredPosition = UF_GetPositionBaseIndex(this.m_LayoutAxis, m_ReposIndex + idx);
             idx++;
         }
         this.rectTransform.sizeDelta = UF_GetLayoutSizeDelta(this.m_LayoutAxis);
     }
     else
     {
         base.OnRebuildLoyout();
     }
 }
Exemple #26
0
 public void UF_AddUI(IUIUpdate ui)
 {
     UF_AddUI(ui, false);
 }
Exemple #27
0
 public override void UF_AddUI(IUIUpdate ui, bool firstSibling)
 {
     base.UF_AddUI(ui, firstSibling);
     m_QueueUI.Enqueue(ui);
 }
Exemple #28
0
 public void UF_SetTarget(IUIUpdate ui)
 {
     UF_SetTarget(((MonoBehaviour)ui).gameObject);
 }
Exemple #29
0
    private static void DrawUpdateGroup(UIUpdateGroup uigroup, int tagidx, Color color)
    {
        if (uigroup == null)
        {
            return;
        }

        GUI.backgroundColor = color;

        GUILayout.BeginHorizontal();
        GUILayout.Space(tagidx * 50);

//		EditorGUILayout.ObjectField (uigroup, uigroup.GetType (),false);

        GUI.contentColor = Color.white;
        EditorTools.DrawPingBox(uigroup, string.Format("{0}  <{1}>", uigroup.updateKey, uigroup.GetType().Name));

        GUILayout.EndHorizontal();

        ++tagidx;

        for (int k = 0; k < uigroup.ListUpdateUI.Count; k++)
        {
            if (uigroup.ListUpdateUI [k] is UIUpdateGroup)
            {
                DrawUpdateGroup(uigroup.ListUpdateUI [k] as UIUpdateGroup, tagidx, color);
            }
            else
            {
                GUI.backgroundColor = color;
                GUILayout.BeginHorizontal();
                GUILayout.Space(tagidx * 50);
                IUIUpdate ui = uigroup.ListUpdateUI[k] as IUIUpdate;
                if (ui != null)
                {
                    EditorTools.DrawPingBox(uigroup.ListUpdateUI[k], string.Format("{0}  <{1}>", ui.updateKey, ui.GetType().Name));
                }
                else
                {
                    GUI.backgroundColor = Color.grey;
                    EditorTools.DrawPingBox(null, "<null>");
                }
                GUILayout.EndHorizontal();
            }
        }

        if (uigroup.MapDynamicUI != null)
        {
            ++tagidx;
            foreach (Object obj in uigroup.MapDynamicUI.Values)
            {
                if (obj is UIUpdateGroup)
                {
                    DrawUpdateGroup(obj as UIUpdateGroup, tagidx, Color.red);
                }
                else
                {
                    GUI.backgroundColor = color;
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(tagidx * 50);
                    IUIUpdate ui = obj as IUIUpdate;

                    if (ui != null)
                    {
                        EditorTools.DrawPingBox(obj, string.Format("{0}  <{1}>", ui.updateKey, ui.GetType().Name));
                    }
                    else
                    {
                        GUI.backgroundColor = Color.grey;
                        EditorTools.DrawPingBox(null, "<null>");
                    }

                    GUILayout.EndHorizontal();
                }
            }
        }
    }