Inheritance: MonoBehaviour
Example #1
0
 public static void Update()
 {
     //every 60sec
     if (Time.time > _lastFPS + 60f)
     {
         _finalReport.AddFPS(HUDFPS.FPS());
         _lastFPS = Time.time;
     }
 }
Example #2
0
    public void Start()
    {
        fpsStyle                  = new GUIStyle();
        fpsStyle.fontSize         = 14;
        fpsStyle.normal.textColor = Color.white;
        HUDFPS hs = FindObjectOfType(typeof(HUDFPS)) as HUDFPS;

        hs.OnFpsChange += fpsChange;        //add the event listener here....
    }
Example #3
0
        void Awake()
        {
            Debug.Log("Coo.Awake");
            if (Coo.ID > 0)
            {
                Destroy(base.gameObject);
                return;
            }

            ID++;
            Coo.go            = base.gameObject;
            Coo.monoBehaviour = this;

            GameObject cameraGO = GameObject.FindWithTag("UICamera");

            if (cameraGO != null)
            {
                uiCamera = cameraGO.GetComponent <Camera>();
            }

            debugLogManager = DebugLogManager.Instance;
            assetManager    = AssetManager.Instance;
            configManager   = ConfigManager.Instance;
            packetManager   = PacketManager.Instance;
            soundManager    = SoundManager.Instance;
            nativeManager   = NativeCodeManager.Instance;
            //plotTalkManager = PlotTalkManager.Instance;
            callUtil      = CallUtil.Instance;
            crashReporter = CrashReporter.Instance;
            luaManager    = new LuaScriptMgr();
            loadManager   = gameObject.AddComponent <LoadManager>();
            menuManager   = gameObject.AddComponent <MenuManager>();
            fps           = gameObject.AddComponent <HUDFPS>();
            fps.enabled   = GameConst.VisiableFPS;

            ShakePhoneEvent shakePhoneEvent = GetComponent <ShakePhoneEvent>();

            if (shakePhoneEvent == null)
            {
                shakePhoneEvent = base.gameObject.AddComponent <ShakePhoneEvent>();
            }
            shakePhoneEvent.OnShake += OpenDebugLogPanel;

            GameObject.DontDestroyOnLoad(base.gameObject);
        }
Example #4
0
        public void ConnectKCP(string host, int iport)
        {
            mHUDFPS = Facade.Instance.GetManager <HUDFPS>(FacadeConfig.ChildSystem_HUDFPS);
            _range  = BASE_DATA_CACHE;
            ipEnd   = new IPEndPoint(IPAddress.Parse(host), iport);
            socket  = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            //socket.Connect(ipEnd);
            IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);

            serverEnd = (EndPoint)sender;
            Kcp_Connect msg = new Kcp_Connect();

            msg.Quickconnect = _quickConnect;
            KcpNetPack pack = KcpNetPack.SerializeToPack(msg, (ushort)Kcp_MsgID.Connected);

            SetHadCheck("Connect");
            var data = pack.Assembly();

            socket.SendTo(data.Bytes, data.Length, SocketFlags.None, ipEnd);
            isConnectting      = true;
            isConnected        = false;
            _lastCheckFailTime = System.Environment.TickCount;
            ConnectReceiveThread_Start();
        }
Example #5
0
        private static void OnUpdate(UnityModManager.ModEntry arg1, float arg2)
        {
            if (Input.GetKeyDown(","))
            {
                float scale    = 1f;
                int   rewardId = 6601;


                CreateTreasure(Player.Self.actor.transform, OtherConfig.Self.UnlimitedRewardBox[3], rewardId, false, scale);
            }
            return;

            if (Input.GetKeyDown(","))
            {
                GameObject[] gos    = SceneManager.GetActiveScene().GetRootGameObjects();
                string       output = "";
                foreach (GameObject go in gos)
                {
                    output += $"GO: {go.name} {go.transform.position}\r\n";
                }
                Dbgl(output);
                //lUnityEngine.Object.Instantiate
            }
            return;

            if (Input.GetKeyDown(",") && Module <Player> .Self.actor != null)
            {
                GameObject[]    roots = SceneManager.GetActiveScene().GetRootGameObjects();
                List <Collider> cols  = new List <Collider>();
                foreach (GameObject go in roots)
                {
                    Collider[] colliders = go.GetComponentsInChildren <Collider>();
                    cols.AddRange(colliders);
                }

                noclip = !noclip;
                Rigidbody component = Module <Player> .Self.actor.GetComponent <Rigidbody>();

                if (component != null)
                {
                    component.useGravity = !noclip;
                }
                Module <Player> .Self.actor.IgnoreCollision(cols, noclip);
            }

            return;

            if (Input.GetKeyDown(","))
            {
                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(3000319, 1), true);
            }
            return;

            if (Input.GetKeyDown("."))
            {
                HUDFPS component = Module <TestClick> .Self.gameObject.GetComponent <HUDFPS>();

                if (component != null)
                {
                    UnityEngine.Object.Destroy(component);
                }
                else
                {
                    Module <TestClick> .Self.gameObject.AddComponent <HUDFPS>();
                }
            }
            if (Input.GetKeyDown("/"))
            {
                DeviceInfo component = Module <TestClick> .Self.gameObject.GetComponent <DeviceInfo>();

                if (component != null)
                {
                    UnityEngine.Object.Destroy(component);
                }
                else
                {
                    Module <TestClick> .Self.gameObject.AddComponent <DeviceInfo>();
                }
            }
            if (Input.GetKeyDown("'"))
            {
                GraphicCtr component = Module <TestClick> .Self.GetComponent <GraphicCtr>();

                if (component)
                {
                    UnityEngine.Object.Destroy(component);
                }
                else
                {
                    Module <TestClick> .Self.gameObject.AddComponent <GraphicCtr>();
                }
            }

            return;

            if (Input.GetKeyDown(","))
            {
                Module <Player> .Self.bag.ChangeMoney(100000, true, 0);
            }
            if (Input.GetKeyDown("."))
            {
                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(1001300, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(1001301, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(3044001, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(3044002, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(3044003, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(3044004, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(4000328, 1), true);

                //Module<Player>.Self.bag.AddItem(ItemObject.CreateItem(5000028, 1), true);
                //Module<Player>.Self.bag.AddItem(ItemObject.CreateItem(5000029, 1), true);
                //Module<Player>.Self.bag.AddItem(ItemObject.CreateItem(5000131, 1), true);
                //Module<Player>.Self.bag.AddItem(ItemObject.CreateItem(5010004, 1), true);
                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000002, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000019, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000020, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000021, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000024, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000025, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000026, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000027, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000028, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000029, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000030, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7000008, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7000023, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010001, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010002, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010003, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010005, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010006, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010007, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010008, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010009, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010010, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8000010, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8000028, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8010001, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8010002, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8010003, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8010004, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8020008, 1), true);

                Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8020009, 1), true);
            }
        }
Example #6
0
 /// <summary>
 /// To be called when game is loaded
 /// </summary>
 public static void AddFPS()
 {
     _finalReport.AddFPS(HUDFPS.FPS());
 }