コード例 #1
0
 public override object[] Call(params object[] args)
 {
     if (L != IntPtr.Zero)
     {
         if (Refid != 0)
         {
             L.getref(Refid);
             return(L.PushArgsAndCall(args));
         }
         else
         {
             if (GLog.IsLogInfoEnabled)
             {
                 GLog.LogInfo("luafunc : null ref");
             }
         }
     }
     else
     {
         if (GLog.IsLogInfoEnabled)
         {
             GLog.LogInfo("luafunc : null state.");
         }
     }
     return(null);
 }
コード例 #2
0
ファイル: Debugger.cs プロジェクト: SilasDarkmoon/CapsMVC
 public static void LogReport(object message)
 {
     if (GLog.IsLogInfoEnabled)
     {
         GLog.LogInfo("<color=#00B500FF>DOTWEEN :: " + message + "</color>");
     }
 }
コード例 #3
0
 public override object[] Call(params object[] args)
 {
     if (L != IntPtr.Zero)
     {
         if (L.isfunction(StackPos))
         {
             L.pushvalue(StackPos);
             return(L.PushArgsAndCall(args));
         }
         else
         {
             if (GLog.IsLogInfoEnabled)
             {
                 GLog.LogInfo("luafunc : the index is not a func.");
             }
         }
     }
     else
     {
         if (GLog.IsLogInfoEnabled)
         {
             GLog.LogInfo("luafunc : null state.");
         }
     }
     return(null);
 }
コード例 #4
0
ファイル: Debugger.cs プロジェクト: SilasDarkmoon/CapsMVC
 public static void Log(object message)
 {
     if (GLog.IsLogInfoEnabled)
     {
         GLog.LogInfo("DOTWEEN :: " + message);
     }
 }
コード例 #5
0
 protected internal override bool SetFieldImp(object key, object val)
 {
     if (_L != IntPtr.Zero)
     {
         if (_L.istable(StackPos))
         {
             using (LuaStateRecover lr = new LuaStateRecover(_L))
             {
                 _L.pushvalue(StackPos);
                 _L.PushLua(key);
                 _L.PushLua(val);
                 _L.rawset(-3);
                 return(true);
             }
         }
         else
         {
             if (GLog.IsLogInfoEnabled)
             {
                 GLog.LogInfo("luatable raw on stack: not a table.");
             }
         }
     }
     else
     {
         if (GLog.IsLogInfoEnabled)
         {
             GLog.LogInfo("luatable raw on stack: null state.");
         }
     }
     return(false);
 }
コード例 #6
0
 protected internal override object GetFieldImp(object key)
 {
     if (_L != IntPtr.Zero)
     {
         if (_L.istable(StackPos))
         {
             using (LuaStateRecover lr = new LuaStateRecover(_L))
             {
                 _L.pushvalue(StackPos);
                 _L.PushLua(key);
                 _L.gettable(-2);
                 return(_L.GetLua(-1));
             }
         }
         else
         {
             if (GLog.IsLogInfoEnabled)
             {
                 GLog.LogInfo("luatable on stack: not a table.");
             }
         }
     }
     else
     {
         if (GLog.IsLogInfoEnabled)
         {
             GLog.LogInfo("luatable on stack: null state.");
         }
     }
     return(null);
 }
コード例 #7
0
 public void ApplyRendererInfo(RendererInfo[] infos)
 {
     try
     {
         for (int i = 0; i < infos.Length; i++)
         {
             var info = infos[i];
             if (info != null && info.renderer != null)
             {
                 info.renderer.lightmapIndex = infos[i].lightmapIndex;
                 if (!info.renderer.isPartOfStaticBatch)
                 {
                     info.renderer.lightmapScaleOffset = infos[i].lightmapOffsetScale;
                 }
                 if (info.renderer.isPartOfStaticBatch && verbose == true)
                 {
                     if (GLog.IsLogInfoEnabled)
                     {
                         GLog.LogInfo("Object " + info.renderer.gameObject.name + " is part of static batch, skipping lightmap offset and scale.");
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         if (GLog.IsLogErrorEnabled)
         {
             GLog.LogError("Error in ApplyRendererInfo:" + e.GetType().ToString());
         }
     }
 }
コード例 #8
0
        private bool IsTurnPage()
        {
            if (totalCount <= 0)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("error element Count =" + totalCount);
                }
                return(false);
            }
            var maxRoll = totalLines;

            if (!isLoop)
            {
                if (currentPageIndex < 0)
                {
                    currentPageIndex = 0;
                    return(true);
                }
                else if (currentPageIndex > (maxRoll - 1))
                {
                    currentPageIndex = maxRoll - 1;
                    return(true);
                }
            }
            else
            {
                currentPageIndex = currentPageIndex % maxRoll;
                if (currentPageIndex < 0)
                {
                    currentPageIndex += maxRoll;
                }
            }
            return(false);
        }
コード例 #9
0
        public override object[] Call(params object[] args)
        {
            Types types = new Types();

            if (args != null)
            {
                for (int i = 0; i < args.Length; ++i)
                {
                    types.Add(args[i].UnwrapDynamic() as Type);
                    if (types[i] == null)
                    {
                        return(null);
                    }
                }
            }
            UniqueCallableCore ucore = _Core.FindAppropriate(types);

            if (ucore == null)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("Cann't find method with appropriate params.");
                }
                return(null);
            }
            else
            {
                var rv = ObjectPool.GetReturnValueFromPool(1);
                rv[0] = ClrCallable.GetFromPool(ucore, Target);
                return(rv);
            }
        }
コード例 #10
0
        public void ScrollToNextGroup()
        { // 不能用itemIndex 会有小数点偏差,改用Round精确判断
            if (totalCount <= 0)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("error element Count =" + totalCount);
                }
                return;
            }
            int pos = 0;

            pos = GetPageIndex();
            pos = pos + 1;

            if (isLoop || Mathf.Abs(contentTransform.anchoredPosition[directionAxisIndex]) + Mathf.Abs(selfTransform.rect.size[directionAxisIndex]) < contentTransform.rect.size[directionAxisIndex])
            {
                MoveOffset(pos);
            }
            else
            {
                var maxNextRoll = totalLines;
                if (currentPageIndex < (maxNextRoll - 1))
                {
                    currentPageIndex = currentPageIndex + 1;
                }
                OnItemIndexChanged(currentPageIndex);
            }
        }
コード例 #11
0
        public void ScrollToPosImmediate(float normalizedPos)
        {
            if (totalCount <= 0)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("error element Count =" + totalCount);
                }
                return;
            }
            float dst = (normalizedPos * otherDirectionAxisIndex + (1 - normalizedPos) * directionAxisIndex) * contentTransform.sizeDelta[directionAxisIndex];

            currentPageIndex     = Mathf.FloorToInt(dst / cellSizeWithSpace[directionAxisIndex]);
            currentInternalIndex = currentPageIndex;
            IsTurnPage();
            contentTransform.anchoredPosition = GetVector2WithDirection(
                FixContentPos(-dst * directionSign[directionAxisIndex]),
                contentTransform.anchoredPosition[otherDirectionAxisIndex]
                );

            itemIndex = int.MaxValue;
            OnItemIndexChanged(currentPageIndex);
            SetCurrentScrollPosition(contentTransform.anchoredPosition[directionAxisIndex]);
            OnValueChange(Vector2.zero);
        }
コード例 #12
0
        public override object[] Call(params object[] args)
        {
            Type[] types = null;
            if (args != null)
            {
                types = ObjectPool.GetParamTypesFromPool(args.Length);
                for (int i = 0; i < args.Length; ++i)
                {
                    types[i] = args[i].UnwrapDynamic() as Type;
                    if (types[i] == null)
                    {
                        return(null);
                    }
                }
            }
            ICallableCore ucore = null;

            if (!_Core._CallableGroups.TryGetValue(types.GetParamsCode(), out ucore))
            {
                ObjectPool.ReturnParamTypesToPool(types);
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("Cann't find method with appropriate params.");
                }
                return(null);
            }
            else
            {
                ObjectPool.ReturnParamTypesToPool(types);
                return(ucore.CreateOverloadSelector(Target).Call(args));
            }
        }
コード例 #13
0
        private void ResetBaseItemData(int index, ScorllItemData itemBase)
        {
            int adjustIndex = index;

            if (isLoop)
            {
                adjustIndex = adjustIndex % totalCount;
                if (adjustIndex < 0)
                {
                    adjustIndex += totalCount;
                }
            }
            itemBase.index = index;
            var rectTransf = itemBase.gameObject.GetComponent <RectTransform>();

            rectTransf.anchoredPosition = GetPosition(index);
            if (adjustIndex < totalCount)
            {
                ResetItemLuaFunc(itemBase.gameObject, index, adjustIndex);
            }
            else
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("index is more than totalCount : " + adjustIndex);
                }
            }
        }
コード例 #14
0
        public object[] Call(object target, params object[] args)
        {
            Types types = new Types();

            if (args != null)
            {
                for (int i = 0; i < args.Length; ++i)
                {
                    if (args[i] != null)
                    {
                        types.Add(args[i].GetType());
                    }
                    else
                    {
                        types.Add(null);
                    }
                }
            }
            UniqueCallableCore ucore = FindAppropriate(types);

            if (ucore == null)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("Cann't find method with appropriate params.");
                }
                return(null);
            }
            return(ucore.Call(target, args));
        }
コード例 #15
0
    public static JSONObject Create()
    {
#if POOLING
        JSONObject result = null;
        while (result == null && releaseQueue.Count > 0)
        {
            result = releaseQueue.Dequeue();
#if DEV
            //The following cases should NEVER HAPPEN (but they do...)
            if (result == null)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("wtf " + releaseQueue.Count);
                }
                else if (result.list != null)
                {
                    if (GLog.IsLogInfoEnabled)
                    {
                        GLog.LogInfo("wtflist " + result.list.Count);
                    }
                }
            }
#endif
        }
        if (result != null)
        {
            return(result);
        }
#endif
        return(new JSONObject());
    }
コード例 #16
0
        protected Material CreateMaterial(Shader s, Material m2Create)
        {
            if (!s)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("Missing shader in " + ToString());
                }
                return(null);
            }

            if (m2Create && (m2Create.shader == s) && (s.isSupported))
            {
                return(m2Create);
            }

            if (!s.isSupported)
            {
                return(null);
            }

            m2Create = new Material(s);
            createdMaterials.Add(m2Create);
            m2Create.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor | HideFlags.HideInHierarchy | HideFlags.NotEditable;

            return(m2Create);
        }
コード例 #17
0
        protected Material CheckShaderAndCreateMaterial(Shader s, Material m2Create)
        {
            if (!s)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("Missing shader in " + ToString());
                }
                enabled = false;
                return(null);
            }

            if (s.isSupported && m2Create && m2Create.shader == s)
            {
                return(m2Create);
            }

            if (!s.isSupported)
            {
                NotSupported();
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("The shader " + s.ToString() + " on effect " + ToString() + " is not supported on this platform!");
                }
                return(null);
            }

            m2Create = new Material(s);
            createdMaterials.Add(m2Create);
            m2Create.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor | HideFlags.HideInHierarchy | HideFlags.NotEditable;

            return(m2Create);
        }
コード例 #18
0
 public virtual ICallableCore BindTypes(Types genericTypes)
 {
     if (genericTypes.Count == _GenericParams.Count)
     {
         UniqueCallableCore core = null;
         _BindedGenericCache.TryGetValue(genericTypes, out core);
         if (core != null)
         {
             return(core);
         }
         else
         {
             MethodInfo mi = null;
             try
             {
                 mi = ((MethodInfo)Method).MakeGenericMethod(genericTypes.ToArray());
             }
             catch { }
             if (mi != null)
             {
                 core = new UniqueCallableCore(mi);
                 _BindedGenericCache[genericTypes] = core;
                 return(core);
             }
             else
             {
                 if (GLog.IsLogInfoEnabled)
                 {
                     GLog.LogInfo("Unable to bind types to generic method.");
                 }
             }
         }
     }
     return(null);
 }
コード例 #19
0
        private static int PrintBase(RealStatePtr L, UnityEngine.LogType type)
        {
            try
            {
                int    n = LuaAPI.lua_gettop(L);
                string s = String.Empty;

                if (0 != LuaAPI.xlua_getglobal(L, "tostring"))
                {
                    return(LuaAPI.luaL_error(L, "can not get tostring in print:"));
                }

                for (int i = 1; i <= n; i++)
                {
                    LuaAPI.lua_pushvalue(L, -1);  /* function to be called */
                    LuaAPI.lua_pushvalue(L, i);   /* value to print */
                    if (0 != LuaAPI.lua_pcall(L, 1, 1, 0))
                    {
                        return(LuaAPI.lua_error(L));
                    }
                    s += LuaAPI.lua_tostring(L, -1);

                    if (i != n)
                    {
                        s += "\t";
                    }

                    LuaAPI.lua_pop(L, 1);  /* pop result */
                }
                switch (type)
                {
                case UnityEngine.LogType.Error:
                    if (GLog.IsLogErrorEnabled)
                    {
                        GLog.LogError("LUA: " + s);
                    }
                    break;

                case UnityEngine.LogType.Warning:
                    if (GLog.IsLogWarningEnabled)
                    {
                        GLog.LogError("LUA: " + s);
                    }
                    break;

                default:
                    if (GLog.IsLogInfoEnabled)
                    {
                        GLog.LogInfo("LUA: " + s);
                    }
                    break;
                }
                return(0);
            }
            catch (System.Exception e)
            {
                return(LuaAPI.luaL_error(L, "c# exception in print:" + e));
            }
        }
コード例 #20
0
 internal protected virtual IEnumerator <KeyValuePair <object, object> > GetEnumeratorImp()
 {
     if (GLog.IsLogInfoEnabled)
     {
         GLog.LogInfo("no enum on fields provider");
     }
     yield break;
 }
コード例 #21
0
 internal protected virtual object GetValueImp(object key)
 {
     if (GLog.IsLogInfoEnabled)
     {
         GLog.LogInfo("no getter on fields provider");
     }
     return(null);
 }
コード例 #22
0
        // Update is called once per frame
        void Update()
        {
            if (lastHeartBeatTime == 0)
            {
                lastHeartBeatTime = Time.unscaledTime;
            }

            if (lastPongTime == 0)
            {
                lastPongTime = Time.unscaledTime;
            }

            // 检测网络状态
            if ((Time.unscaledTime - lastPongTime) >= PONG_INTERVAL)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("SocketDispatch Update step 1 NETWORK_ERR");
                }
                SocketManager.Instance.OnChanageSocketState(SocketState.NETWORK_ERR);
                lastPongTime = 0;
            }

            if ((Time.unscaledTime - lastHeartBeatTime >= HEART_BEAT_INTERVAL) &&
                (ClientSocket.GetSocketConnectState()))
            {
                ClientSocket.Send(2, "{}");
                lastHeartBeatTime = Time.unscaledTime;
            }

#if UNITY_EDITOR
            if (lastCheckTime == 0)
            {
                lastCheckTime = Time.unscaledTime;
            }

            if (Time.unscaledTime - lastCheckTime >= Check_Time)
            {
                if (!ClientSocket.GetSocketConnectState())
                {
                    if (GLog.IsLogErrorEnabled)
                    {
                        GLog.LogError("SocketDispatch step 2 socket DisConnect !!!");
                    }
                }
                else
                {
                    //if (GLog.IsLogInfoEnabled) GLog.LogInfo("SocketDispatch step 2 ");
                }

                lastCheckTime = Time.unscaledTime;
            }
#endif

            ClientSocket.Update();
        }
コード例 #23
0
 private void _onConnetThread()
 {
     if (GLog.IsLogInfoEnabled)
     {
         GLog.LogInfo("SocketManager _onConnetThread step 1");
     }
     _connectThread = new Thread(_onConnet);
     _connectThread.IsBackground = true;
     _connectThread.Start();
 }
コード例 #24
0
        public override object[] Call(object target, params object[] args)
        {
            if (args == null || args.Length <= 0)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("Unable to determine types of the generic method from the calling args - empty args.");
                }
            }
            else
            {
                if (args.Length == _GenericParams.Count)
                {
                    Types types    = new Types();
                    bool  allTypes = true;
                    foreach (var arg in args)
                    {
                        if (!(arg is Type))
                        {
                            allTypes = false;
                            break;
                        }
                    }
                    if (allTypes)
                    {
                        for (int i = 0; i < args.Length; ++i)
                        {
                            types.Add(args[i] as Type);
                        }
                        ICallableCore core = BindTypes(types);
                        if (core != null)
                        {
                            var rv = ObjectPool.GetReturnValueFromPool(1);
                            rv[0] = ClrCallable.GetFromPool(core, target);
                            return(rv);
                        }
                    }
                }

                // try to determine generic type params.
                var cored = this.DetermineGenericTypeArg(args);
                if (cored != null)
                {
                    return(cored.Call(target, args));
                }
                else
                {
                    if (GLog.IsLogInfoEnabled)
                    {
                        GLog.LogInfo("Unable to determine types of the generic method from the calling args.");
                    }
                }
            }
            return(null);
        }
コード例 #25
0
 public static int ClrFuncPrint(IntPtr l)
 {
     using (var lr = new LuaStateRecover(l))
     {
         var obj = l.GetLua(1).UnwrapDynamic();
         if (GLog.IsLogInfoEnabled)
         {
             GLog.LogInfo(obj);
         }
     }
     return(0);
 }
コード例 #26
0
 /// <summary>
 /// 连接服务器
 /// </summary>
 /// <param name="ip"></param>
 /// <param name="port"></param>
 /// <param name="callBack">回调函数,成功/失败都回调</param>
 public static void Connect(string ip, int port, Action <int> callBack)
 {
     if ("".Equals(ip) || ip == null)
     {
         if (GLog.IsLogInfoEnabled)
         {
             GLog.LogInfo("ClientSocket Connect step 1");
         }
         return;
     }
     NetReceiver.Init();
     SocketManager.Instance.Connect(ip, port, callBack);
 }
コード例 #27
0
    private void Update()
    {
        if ((Time.realtimeSinceStartup - lastTime) < interval)
        {
            return;
        }
        // 如果socket还没有连接,则不发送安全sdk数据
        if (!Capstones.UnityFramework.Network.ClientSocket.GetSocketConnectState())
        {
            return;
        }

        lastTime = Time.realtimeSinceStartup;

        IntPtr addr = TssSdk.tss_get_report_data();

        if (addr != IntPtr.Zero)
        {
            TssSdk.AntiDataInfo info = new TssSdk.AntiDataInfo();
            if (TssSdk.Is64bit())
            {
                short anti_data_len = Marshal.ReadInt16(addr, 0);
                Int64 anti_data     = Marshal.ReadInt64(addr, 2);
                info.anti_data_len = (ushort)anti_data_len;
                info.anti_data     = new IntPtr(anti_data);
            }
            else if (TssSdk.Is32bit())
            {
                short anti_data_len = Marshal.ReadInt16(addr, 0);
                Int32 anti_data     = Marshal.ReadInt32(addr, 2);
                info.anti_data_len = (ushort)anti_data_len;
                info.anti_data     = new IntPtr(anti_data);
            }

            // 数据长度大于1024的直接丢弃
            if (info.anti_data_len > 1024)
            {
                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("Tsssdk上报数据长度大于1024,丢弃");
                }
                TssSdk.tss_del_report_data(addr);
                return;
            }

            if (SendDataToServer(info))
            {
                TssSdk.tss_del_report_data(addr);
            }
        }
    }
コード例 #28
0
 void Awake()
 {
     ProfilerUtl.Init();
     Capstones.PlatExt.PlatDependant.Init();
     if (GLog.IsLogInfoEnabled)
     {
         GLog.LogInfo("Awake run 1");
     }
     if (dynRoot != null)
     {
         if (GLog.IsLogInfoEnabled)
         {
             GLog.LogInfo("Awake run 2");
         }
         dynRoot.ApplySource();
         if (GLog.IsLogInfoEnabled)
         {
             GLog.LogInfo("Awake run 3");
         }
         var go = dynRoot._Child;
         if (GLog.IsLogInfoEnabled)
         {
             GLog.LogInfo("Awake run 4");
         }
         if (go != null)
         {
             if (GLog.IsLogInfoEnabled)
             {
                 GLog.LogInfo("Awake run 5");
             }
             var datacomp = go.GetComponent <LuaBehaviour>();
             if (GLog.IsLogInfoEnabled)
             {
                 GLog.LogInfo("Awake run 6");
             }
             if (datacomp != null)
             {
                 if (GLog.IsLogInfoEnabled)
                 {
                     GLog.LogInfo("Awake run 7");
                 }
                 dataDict = datacomp.ExpandExVal();
             }
         }
     }
     if (GLog.IsLogInfoEnabled)
     {
         GLog.LogInfo("Awake run 8");
     }
     textDesc.text = GetDataStr("DescStr");
 }
コード例 #29
0
        /// <summary>
        /// 连接操作完成
        /// 可能成功,可能失败
        /// </summary>
        /// <param name="iar"></param>
        private void _onConnect_complete(IAsyncResult iar)
        {
            try
            {
                Socket client = (Socket)iar.AsyncState;
                client.EndConnect(iar);

                if (GLog.IsLogInfoEnabled)
                {
                    GLog.LogInfo("_onConnect_complete step 1");
                }
                var clientSocket = _clientSocket;
                if (clientSocket != null && !clientSocket.Connected)
                {
                    if (GLog.IsLogInfoEnabled)
                    {
                        GLog.LogInfo("_onConnect_complete step 2");
                    }
                    OnChanageSocketState(SocketState.CONNECT_FAIL);
                    _close();
                    return;
                }

                _isInitThreadStart          = true;
                _receiveThread              = new Thread(_onReceiveSocket);
                _receiveThread.IsBackground = true;
                _receiveThread.Start();
                if (connetcSuccess != null)
                {
                    connetcSuccess();
                }
                OnChanageSocketState(SocketState.SUCCESS);
            }
            catch (Exception e)
            {
                if (GLog.IsLogErrorEnabled)
                {
                    GLog.LogException("_onConnect_complete = " + e.Message);
                }
                if (e is ThreadAbortException)
                {
                    // ThreadAbortException异常比较特殊,只要Abort一定会抛出此异常,属于正常现象,不需要记录错误。
                    // 但是,ThreadAbortException即便被catch了,也会再次抛出,然而抛出异常可能导致游戏闪退,所以必须阻止此异常再次抛出。
                    // 因此,这里调用Thread.ResetAbort阻止线程被中止,并且break跳出循环以便线程正常结束。
                    Thread.ResetAbort();
                    return;
                }
                _close();
            }
        }
コード例 #30
0
    public void BuildLightingScenario(string ScenarioName)
    {
        //Remove reference to LightingDataAsset so that Unity doesn't delete the previous bake
        Lightmapping.lightingDataAsset = null;

        if (GLog.IsLogInfoEnabled)
        {
            GLog.LogInfo("Baking" + ScenarioName);
        }

        EditorSceneManager.OpenScene("Assets/CapstonesRes/Game/Models/Scene/LightingMapData/" + ScenarioName + ".unity", OpenSceneMode.Additive);
        EditorSceneManager.SetActiveScene(EditorSceneManager.GetSceneByPath("Assets/CapstonesRes/Game/Models/Scene/LightingMapData/" + ScenarioName + ".unity"));

        StartCoroutine(BuildLightingAsync(ScenarioName));
    }