// static Deserializer deserializer = new Deserializer();

    private static void MessageReceiveCallBack(InputNetworkMessageEvent inputEvent)
    {
        if (ApplicationManager.Instance.m_AppMode != AppMode.Release)
        {
            Debug.Log("MessageReceiveCallBack ;" + JsonUtils.ToJson(inputEvent));
        }

        Type type = Type.GetType(inputEvent.m_MessgaeType);

        if (type == null)
        {
            Debug.LogError("No MessgaeType :" + inputEvent.m_MessgaeType);
            return;
        }

        object dataObj = JsonUtils.FromJson(type, inputEvent.Data["Content"].ToString());// deserializer.Deserialize(type, inputEvent.Data["Content"].ToString());
        MessageClassInterface msgInterface = (MessageClassInterface)dataObj;

        msgInterface.DispatchMessage();

        if (msgInterface is CodeMessageBase)
        {
            CodeMessageBase codeMsg = (CodeMessageBase)msgInterface;

            GlobalEvent.DispatchEvent(ErrorCodeMessage, codeMsg);
        }
    }
    void SelectLanguageGUI()
    {
        GUILayout.BeginHorizontal();
        currentLanguage = EditorDrawGUIUtil.DrawPopup("当前语言", currentLanguage, config.gameExistLanguages, (lan) =>
        {
            if (!string.IsNullOrEmpty(selectFullFileName))
            {
                currentFileDataTable = LanguageDataUtils.LoadFileData(lan, selectFullFileName);
            }
            Debug.Log("切换到:" + lan);
            LanguageManager.SetLanguage(lan);
        });
        if (currentLanguage == SystemLanguage.Chinese)
        {
            currentLanguage = SystemLanguage.ChineseSimplified;
        }

        if (GUILayout.Button("加载上一次保存"))
        {
            DataManager.CleanCache();
            LanguageManager.IsInit = false;
            GlobalEvent.DispatchEvent(EditorEvent.LanguageDataEditorChange);
            currentFileDataTable = LanguageDataUtils.LoadFileData(currentLanguage, selectFullFileName);
            GUI.FocusControl("");
        }
        if (GUILayout.Button("检查修复多语言完整性"))
        {
            CheckAllLanguageFileIntact();
        }
        GUILayout.EndHorizontal();
    }
Пример #3
0
    public static void NextLine()
    {
        s_currentLine++;
        s_questionTime = Time.time;

        if (s_currentLine < currentPoemData.m_content.Length)
        {
            if (currentPoemData.m_content[s_currentLine].Contains("space"))
            {
                GlobalEvent.DispatchEvent(GameEventEnum.CreateSpace);
                s_currentLine++;
            }

            CreateAnswer();
        }
        else
        {
            if (s_GameModel == GameModel.normal)
            {
                ApplicationStatusManager.GetStatus <GameStatus>().OpenFinishUI();
            }
            else
            {
                NewPoem();
                GlobalEvent.DispatchEvent(GameEventEnum.NextPoem);
            }
        }
    }
    public static void SetLanguage(SystemLanguage lang)
    {
        SystemLanguage oldLan = s_currentLanguage;

        if (config == null)
        {
            return;
        }
        if (config.gameExistLanguages.Contains(lang))
        {
            s_currentLanguage = lang;
        }
        else
        {
            //Debug.Log("当前语言不存在 " + lang);

            s_currentLanguage = config.defaultLanguage;
        }
        if (oldLan != s_currentLanguage)
        {
            s_languageDataDict.Clear();
        }

        GlobalEvent.DispatchEvent(LanguageEventEnum.LanguageChange, lang);
    }
Пример #5
0
    //void CheckCurrentFrame(DebugMsg msg)
    //{
    //    //Debug.Log("CheckCurrentFrame " + msg.frame);
    //    for (int i = 0; i < msg.infos.Count; i++)
    //    {
    //        if (m_world.GetEntityIsExist(msg.infos[i].id))
    //        {
    //            EntityBase entity = m_world.GetEntity(msg.infos[i].id);

    //            for (int j = 0; j < msg.infos[i].infos.Count; j++)
    //            {
    //                if (msg.infos[i].infos[j].m_compName == "CommandComponent")
    //                {
    //                    CheckCommandLogic(msg, msg.infos[i], msg.infos[i].infos[j]);
    //                }
    //                else
    //                {
    //                    CheckCurrentComponentLogic(msg, entity, msg.infos[i], msg.infos[i].infos[j]);
    //                }
    //            }
    //        }
    //        else
    //        {
    //            //string log = "error not find entity frame " + msg.frame + " currentFrame:" + m_world.FrameCount + " id:" + msg.infos[i].id + "\n";
    //            //Debug.LogWarning(log);
    //            //syncLog += log;
    //        }
    //    }

    //    for (int i = 0; i < msg.singleCompInfo.Count; i++)
    //    {
    //        CheckCurrentSingleComponentLogic(msg, msg.singleCompInfo[i]);
    //    }
    //}

    //void CheckHistotryFrame(DebugMsg msg)
    //{
    //    //Debug.Log("CheckHistotryFrame");
    //    for (int i = 0; i < msg.infos.Count; i++)
    //    {
    //        if (m_world.GetEntityIsExist(msg.infos[i].id))
    //        {
    //            for (int j = 0; j < msg.infos[i].infos.Count; j++)
    //            {
    //                if (msg.infos[i].infos[j].m_compName == "CommandComponent")
    //                {
    //                    CheckCommandLogic(msg, msg.infos[i], msg.infos[i].infos[j]);
    //                }
    //                else
    //                {
    //                    CheckComponentLogic(msg, msg.infos[i], msg.infos[i].infos[j]);
    //                }
    //            }
    //        }
    //        else
    //        {
    //            //string log = "error not find entity frame " + msg.frame + " currentFrame:" + m_world.FrameCount + " id:" + msg.infos[i].id + "\n";
    //            //Debug.LogWarning(log);
    //        }
    //    }

    //    for (int i = 0; i < msg.singleCompInfo.Count; i++)
    //    {
    //        CheckSingleComponentLogic(msg, msg.singleCompInfo[i]);
    //    }
    //}

    //void CheckCurrentCommandLogic(DebugMsg msg, EntityBase entity, EntityInfo entityInfo, ComponentInfo compInfo)
    //{

    //}

    void CheckCurrentComponentLogic(DebugMsg msg, EntityBase entity, EntityInfo entityInfo, ComponentInfo compInfo)
    {
        //Debug.Log("CheckCurrentComponentLogic");

        if (!m_world.GetExistRecordSystem(compInfo.m_compName))
        {
            return;
        }

        ComponentBase compLocal = entity.GetComp(compInfo.m_compName);

        if (IsFilter(compInfo.m_compName))
        {
            string content = Serializer.Serialize(compLocal);

            if (!content.Equals(compInfo.content))
            {
                RecordSystemBase rsb = m_world.GetRecordSystemBase(compInfo.m_compName);

                string log = "error: frame" + msg.frame + " currentFrame:" + m_world.FrameCount + " id:" + entity.ID + " msg.id " + entityInfo.id + " comp:" + compInfo.m_compName + "\n remote:" + compInfo.content + "\n local:" + content + "\n";
                Debug.LogWarning(log);
                rsb.PrintRecord(entity.ID);

                //派发冲突
                GlobalEvent.DispatchEvent(c_isConflict, msg.frame);

                Time.timeScale = 0;
                OutPutDebugRecord();
            }
            else
            {
                //Debug.Log("ReceviceDebugMsg  correct! frame " + msg.frame + " currentFrame:" + m_world.FrameCount + " id:" + entity.ID + " msg.id " + entityInfo.id + " comp:" + compInfo.m_compName + " content :" + compInfo.content);
            }
        }
    }
Пример #6
0
    private static void OnCreateAssetCallBack(string t)
    {
        List <string> paths = new List <string>();

        paths.Add(t);
        UpdateAsset(paths);
        GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnCreateAsset, t);
    }
Пример #7
0
    private static void OnDeleteAssetCallBack(AssetDeleteResult t, string t1, RemoveAssetOptions t2)
    {
        List <string> paths = new List <string>();

        paths.Add(t1);
        UpdateAsset(paths);
        GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnDeleteAsset, t, t1, t2);
    }
Пример #8
0
    /// <summary>
    /// 释放堆内存
    /// </summary>
    public static void FreeHeapMemory()
    {
        GlobalEvent.DispatchEvent(MemoryEvent.FreeHeapMemory);

        DataManager.CleanCache();
        ConfigManager.CleanCache();
        RecordManager.CleanCache();
    }
Пример #9
0
 public static void RemoveDifficulty(string difficulty)
 {
     if (DifficultyLevels.Contains(difficulty) && DifficultyLevels.Count > 1)
     {
         DifficultyLevels.Remove(difficulty);
         GlobalEvent.DispatchEvent(GameOptionEventEnum.DifficultyChange);
         SaveOption();
     }
 }
Пример #10
0
    private static void OnSaveAssetsCallBack(string[] t)
    {
        List <string> paths = new List <string>();

        paths.AddRange(t);
        UpdateAsset(paths);

        GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnSaveAssets, t);
    }
Пример #11
0
 public static void RemovePoemType(string poemType)
 {
     if (s_poemTypes.Contains(poemType) && s_poemTypes.Count > 1)
     {
         s_poemTypes.Remove(poemType);
         GlobalEvent.DispatchEvent(GameOptionEventEnum.PoemLibChange);
         SaveOption();
     }
 }
Пример #12
0
 public static void AddPoemType(string poemType)
 {
     if (!s_poemTypes.Contains(poemType))
     {
         s_poemTypes.Add(poemType);
         GlobalEvent.DispatchEvent(GameOptionEventEnum.PoemLibChange);
         SaveOption();
     }
 }
Пример #13
0
 public static void AddDifficulty(string difficulty)
 {
     if (!DifficultyLevels.Contains(difficulty))
     {
         DifficultyLevels.Add(difficulty);
         GlobalEvent.DispatchEvent(GameOptionEventEnum.DifficultyChange);
         SaveOption();
     }
 }
    void SaveData()
    {
        LanguageDataUtils. SaveEditorConfig(config);
        LanguageDataEditorUtils.SaveData(currentLanguage, selectFullFileName, currentFileDataTable);

        LanguageManager.IsInit = false;

        LanguageManager.Release();
        GlobalEvent.DispatchEvent(EditorEvent.LanguageDataEditorChange);
    }
Пример #15
0
    private void TriggerTakeOffBook(InteractionScript script)
    {
        m_bookSlot.SetActive(false);
        script.gameObject.SetActive(true);
        Character character = FindObjectOfType <Character>();

        character.PickUpItem(script);

        GlobalEvent.DispatchEvent("BookCaseUp");
    }
Пример #16
0
    /// <summary>
    /// 释放内存
    /// </summary>
    public static void FreeMemory()
    {
        GlobalEvent.DispatchEvent(MemoryEvent.FreeMemory);

        //清空对象池

        FreeHeapMemory();

        //GC
        //GC.Collect();
    }
Пример #17
0
    private void Start()
    {
        GlobalEvent.Init();

        GlobalEvent.AddEvent(GameEnums.Hello, Say_Hello_A);

        GlobalEvent.DispatchEvent(GameEnums.Hello, "1", "2", "3", "4");

        GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A);
        GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A);
        GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A);
    }
    void SaveData()
    {
        LanguageDataUtils.SaveEditorConfig(config);
        LanguageDataEditorUtils.SaveData(currentLanguage, selectFullFileName, currentFileDataTable);



        LanguageManager.Release();
        LanguageManager.SetLanguage(currentLanguage);

        GlobalEvent.DispatchEvent(EditorEvent.LanguageDataEditorChange);
        UnityEditor.AssetDatabase.Refresh();
    }
    void CheckComponentLogic(DebugMsg msg, EntityInfo entityInfo, ComponentInfo compInfo)
    {
        //Debug.Log("CheckComponentLogic");

        if (!m_world.GetExistRecordSystem(compInfo.m_compName))
        {
            return;
        }

        RecordSystemBase rsb       = m_world.GetRecordSystemBase(compInfo.m_compName);
        ComponentBase    compLocal = rsb.GetRecord(entityInfo.id, msg.frame);

        if (IsFilter(compInfo.m_compName))
        {
            if (compLocal != null)
            {
                string content = Serializer.Serialize(compLocal);

                if (!content.Equals(compInfo.content))
                {
                    string log = "error: frame " + msg.frame + " currentFrame:" + m_world.FrameCount + " id:" + entityInfo.id + " comp:" + compInfo.m_compName
                                 + "\n remote:" + compInfo.content
                                 + "\n local:" + content + "\n";
                    Debug.LogWarning(log);
                    rsb.PrintRecord(entityInfo.id);

                    Time.timeScale = 0;
                    Record(log);
                    OutPutDebugRecord();
                }
                else
                {
                    //Debug.Log("ReceviceDebugMsg  correct! frame " + msg.frame + " currentFrame:" + m_world.FrameCount + " id:" + entityInfo.id + " comp:" + compInfo.m_compName + " content :" + compInfo.content);
                }

                //派发冲突
                GlobalEvent.DispatchEvent(c_isConflict, msg.frame);
            }
            else
            {
                //string log = "not find Record ->> frame:" + msg.frame + " id " + entityInfo.id + " compName: " + compInfo.m_compName + " currentframe: " + m_world.FrameCount + " content " + compInfo.content;

                //Debug.LogWarning(log);
                //syncLog += log;
            }
        }
        else
        {
            Debug.Log("Not is filter " + compInfo.m_compName);
        }
    }
Пример #20
0
    /// <summary>
    /// 释放内存
    /// </summary>
    public static void FreeMemory()
    {
        GlobalEvent.DispatchEvent(MemoryEvent.FreeMemory);

        //清空对象池
        GameObjectManager.CleanPool();

        //清空缓存的UI
        UIManager.DestroyAllHideUI();

        FreeHeapMemory();

        //GC
        //GC.Collect();
    }
    public static void SetLanguage(SystemLanguage lang)
    {
        s_currentLanguage = lang;

        if (s_LanguageList.Contains(lang.ToString()))
        {
            Loadlanguage(lang);
        }
        else
        {
            Debug.Log("当前语言不存在 " + lang);

            Loadlanguage(s_defaultlanguage);
        }

        GlobalEvent.DispatchEvent(LanguageEventEnum.LanguageChange, lang);
    }
Пример #22
0
    void Explode( )
    {
        if (explodeObj)
        {
            var t = explodeObj.transform;
            int c = t.childCount;
            for (int i = 0; i < c; i++)
            {
                t.GetChild(i).gameObject.BroadcastMessage("Explode");
                GlobalEvent.DispatchEvent(CameraMovement.CameraEvn.ToFont, -90f, 14f);
            }
        }

        gameObject.SetActive(false);

        isExploded = true;
    }
Пример #23
0
    /// <summary>
    /// 释放内存
    /// </summary>
    public static void FreeMemory()
    {
        GlobalEvent.DispatchEvent(MemoryEvent.FreeMemory);
        //清空缓存的UI
        UIManager.DestroyAllHideUI();
        //清空对象池
        GameObjectManager.CleanPool(true);

        //GameObjectManager.CleanPool_New();

        AssetsPoolManager.Dispose();

        FreeHeapMemory();
        Resources.UnloadUnusedAssets();
        //GC
        //GC.Collect();
    }
Пример #24
0
    /// <summary>
    /// 释放内存
    /// </summary>
    public static void FreeMemory()
    {
        GlobalEvent.DispatchEvent(MemoryEvent.FreeMemory);
        //清空缓存的UI
        UIManager.DestroyAllHideUI();

        //清空对象池
        GameObjectManager.CleanPool();

        LanguageManager.Release();

        // AssetsUnloadHandler.UnloadAll();

        FreeHeapMemory();
        Resources.UnloadUnusedAssets();
        //GC
        GC.Collect();
    }
Пример #25
0
    private void TriggerWithBook(InteractionScript script)
    {
        //
        // script.transform.parent = transform;
        // script.transform.localPosition = Vector3.zero;

        m_bookSlot.SetActive(true);

        Character character = FindObjectOfType <Character>();

        character.DropCarryItem();
        script.gameObject.SetActive(false);

        GlobalEvent.DispatchEvent("BookCaseDown");
        // LeanTween.moveLocal(gameObject, m_downPosition, 0.3f).setEaseInOutSine().setOnComplete((o =>
        // {
        //     GlobalEvent.DispatchEvent("BookCaseDown");
        // }));
    }
Пример #26
0
    private void TriggerWithCaseKey(InteractionScript script)
    {
        GlobalEvent.DispatchEvent("Box_Opened");

        CaseKeyInteraction caseKey = script as CaseKeyInteraction;

        if (caseKey != null)
        {
            m_aniamtor.Play("Box_Open");
            script.gameObject.SetActive(false);
            Character character = FindObjectOfType <Character>();
            character.DropCarryItem();
            character.PlayAudio("key_interaction");

            m_key.gameObject.SetActive(true);
            LeanTween.moveLocalX(m_key.gameObject, -3.05f, 0.5f).setEaseInOutSine();
            LeanTween.moveLocalY(m_key.gameObject, 0.62f, 0.25f).setEaseInCirc();
            LeanTween.moveLocalY(m_key.gameObject, -0.22f, 0.25f).setEaseOutCirc().setDelay(0.25f);
        }
    }
    /// <summary>
    /// 释放内存
    /// </summary>
    public static void FreeMemory()
    {
        GlobalEvent.DispatchEvent(MemoryEvent.FreeMemory);
        //清空缓存的UI
        UIManager.DestroyAllHideUI();
        if (IsLowMachine())
        {
            //清空对象池
            GameObjectManager.CleanPool();
        }
        LanguageManager.Release();
        //GameObjectManager.CleanPool_New();

        // AssetsPoolManager.DisposeAll();

        FreeHeapMemory();
        Resources.UnloadUnusedAssets();
        //GC
        GC.Collect();
    }
Пример #28
0
    public override void DropDownItem(Transform character)
    {
        if (m_rigidBody2D != null)
        {
            m_rigidBody2D.isKinematic = false;
        }
        LeanTween.moveY(gameObject, m_recordY, 0.3f).setEaseInCirc().setOnComplete((o =>
        {
            transform.parent = m_parent;
            m_render.sortingOrder = m_recordSortLayer;
            Vector3 position = new Vector3(character.position.x, m_recordY, 0f);
            gameObject.transform.position = position;
            m_collider2D.enabled = true;

            GlobalEvent.DispatchEvent("WeightDropDown");
            GlobalEvent.DispatchEvent("ShakeCamera");

            Character player = FindObjectOfType <Character>();
            player.PlayAudio("weight_drop_down");
        }));
    }
    void SelectLanguageGUI()
    {
        GUILayout.BeginHorizontal();
        currentLanguage = EditorDrawGUIUtil.DrawPopup("当前语言", currentLanguage, config.gameExistLanguages, (lan) =>
           {

           });
        if (currentLanguage == SystemLanguage.Chinese)
            currentLanguage = SystemLanguage.ChineseSimplified;

        if (GUILayout.Button("加载上一次保存"))
        {

            DataManager.CleanCache();
            LanguageManager.IsInit = false;
            GlobalEvent.DispatchEvent(EditorEvent.LanguageDataEditorChange);
            currentFileDataTable = LanguageDataUtils.LoadFileData(currentLanguage, selectFullFileName);
            GUI.FocusControl("");
        }
        GUILayout.EndHorizontal();
    }
Пример #30
0
    private static void UpdateAsset(List <string> paths)
    {
        bool isUpdate = false;

        foreach (var item in paths)
        {
            if (item.Contains("Assets/Resources"))
            {
                isUpdate = true;
                break;
            }
        }
        if (isUpdate)
        {
            AssetsSortEidtorWindow.RefreshResData();
            AssetBundleBuildUtils.CreateAllResPathInfo("Assets/Resources");
            ResourcePathManager.Clear();

            GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnResourcesAssetsChange);
        }
    }