예제 #1
0
        internal static void DebugDeclarationApplication(IStyleClient client, List <StyleDeclaration> styleDeclarations)
        {
            StringBuilder sb = new StringBuilder();

            // 1. title
            sb.AppendLine(string.Format(@"### Applying {0} style declarations ###", styleDeclarations.Count));

            var comp = client as Component;

            // 2. path
            sb.AppendLine(ComponentUtil.PathToString(comp, "->"));

            if (null != comp)
            {
                // 3. class/id
                string className = "";
                if (comp.StyleName is string && !string.IsNullOrEmpty((string)comp.StyleName))
                {
                    className = (string)comp.StyleName;
                }
                string id = "";
                if (!string.IsNullOrEmpty(comp.Id))
                {
                    id = comp.Id;
                }

                if (!string.IsNullOrEmpty(className) || !string.IsNullOrEmpty(id))
                {
                    string text = string.Empty;
                    if (!string.IsNullOrEmpty(className))
                    {
                        text += "class: " + className + ";";
                    }
                    if (!string.IsNullOrEmpty(id))
                    {
                        text += "id: " + id + ";";
                    }
                    sb.AppendLine(text);
                }
            }

            // 4. declarations
            sb.AppendLine(ListUtil <StyleDeclaration> .Format(styleDeclarations));

            Debug.Log(sb);
        }
예제 #2
0
        /// <summary>
        /// Parameters: target, fraction, startValue, endValue
        /// </summary>
        /// <param name="parameters"></param>
        private static void TweenErrorSlot(object[] parameters)
        {
            object    target     = parameters[0];
            Tween     tween      = (Tween)parameters[1];
            float     fraction   = (float)parameters[2];
            object    startValue = parameters[3];
            object    endValue   = parameters[4];
            Exception exception  = (Exception)parameters[5];

            Component component = target as Component;

            Debug.LogError(string.Format(@"Interpolation error, Target: {0}{1}
fraction: {2}, startValue: {3}, endValue: {4}
exception: {5}", ComponentUtil.PathToString(component, "->"), string.IsNullOrEmpty(tween.Name) ? string.Empty : string.Format(" [{0}]", tween.Name),
                                         fraction, startValue.GetType(), endValue.GetType(),
                                         exception));

//        if (null != component)
//        {
//            Debug.LogError("Component: " + ComponentUtil.PathToString(component, "->"));
//        }
        }