예제 #1
0
    public static T GetData(string key)
    {
        if (key == null)
        {
            throw new Exception("DataGenerateManager<" + typeof(T).Name + "> GetData key is Null !");
        }

        //清理缓存
        if (!s_isInit)
        {
            s_isInit = true;
            GlobalEvent.AddEvent(MemoryEvent.FreeHeapMemory, CleanCatch);
        }

        if (s_dict.ContainsKey(key))
        {
            return(s_dict[key]);
        }
        else
        {
            T data = new T();
            data.LoadData(key);
            s_dict.Add(key, data);
            return(data);
        }
    }
예제 #2
0
    bool NewMapFileGUI()
    {
        GUILayout.BeginHorizontal("box");
        newFileName = EditorDrawGUIUtil.DrawBaseValue("新建地图文件", newFileName).ToString();
        if (GUILayout.Button("确定", GUILayout.Width(50)))
        {
            if (ResourcePathManager.ContainsFileName(newFileName))
            {
                EditorUtility.DisplayDialog("错误", "文件名与其他文件重复", "OK");
                return(true);
            }
            MapInfomation info = new MapInfomation();
            info.id = GetMaxID() + 1;
            //info.sceneName = "Scene_" + newFileName;
            info.mapFileName = MapUseConstValues.MapFileNamePrefix + newFileName;
            MapManager.MapInfosDic.Add(info.id, info);

            GlobalEvent.AddEvent(EditorGlobalEventEnum.OnResourcesAssetsChange, (t) =>
            {
                Initialize();
            }, true);
            SaveMapInfoData();

            FileUtils.CreateTextFile(MapUseConstValues.MapDataDirectory + info.mapFileName + "/" + info.mapFileName + ".txt", "");
            AssetDatabase.Refresh();

            return(false);
        }
        GUILayout.EndHorizontal();
        return(true);
    }
예제 #3
0
    protected override void OnStart()
    {
        base.OnStart();

        GlobalEvent.AddEvent("BookCaseDown", HandleBookCaseDown);
        GlobalEvent.AddEvent("BookCaseUp", HandleBookCaseUp);
    }
예제 #4
0
    public override void OnCreate()
    {
        ResetLOD(RenderManager.LOD);
        GlobalEvent.AddEvent(RenderEventEnum.UpdateLOD, ReceviceUpdateLOD);

        //Debug.Log("OnCreate " + (RenderManager.LOD));
    }
    protected override void OnStart()
    {
        base.OnStart();
        m_aintAttack.gameObject.SetActive(false);

        GlobalEvent.AddEvent("Box_Opened", HandleBlockHoleOpened);
    }
예제 #6
0
    //UI的初始化请放在这里
    public override void OnOpen()
    {
        GlobalEvent.AddEvent(GameEventEnum.QuestionChange, UpdateQuestion);
        GlobalEvent.AddEvent(GameEventEnum.CreateSpace, AddSpace);
        GlobalEvent.AddEvent(GameEventEnum.NextPoem, NewPoem);
        GlobalEvent.AddEvent(GameEventEnum.ScoreChange, ChangeScore);
        GlobalEvent.AddEvent(GameEventEnum.HpChange, ChangeHP);

        GlobalEvent.AddEvent(GameEventEnum.ShowScoreLevel, ShowScoreLevel);

        AddOnClickListener("Button_answer1", OnClickAnswer, "1");
        AddOnClickListener("Button_answer2", OnClickAnswer, "2");
        AddOnClickListener("Button_answer3", OnClickAnswer, "3");
        AddOnClickListener("Button_answer4", OnClickAnswer, "4");

        if (GameLogic.s_GameModel == GameModel.Arcade)
        {
            SetActive("Text_score", true);
            SetActive("Text_HP", true);

            ChangeHP();
            ChangeScore();
        }
        else
        {
            SetActive("Text_score", false);
            SetActive("Text_HP", false);
        }
    }
예제 #7
0
    public override void OnInit()
    {
        base.OnInit();

        GlobalEvent.AddEvent(LanguageEventEnum.LanguageChange, ReceviceLanguageChange);
        GlobalEvent.AddEvent(GameOptionEventEnum.PoemLibChange, RecevicePoemOptionChange);
        AddOnClickListener("layout", OnClickItem);
    }
예제 #8
0
 public void AddEventListener(Enum l_Event)
 {
     if (!m_EventNames.Contains(l_Event))
     {
         m_EventNames.Add(l_Event);
         GlobalEvent.AddEvent(l_Event, Refresh);
     }
 }
    protected override void OnStart()
    {
        base.OnStart();

        m_animator = GetComponent <Animator>();

        GlobalEvent.AddEvent("Cellar_Open", HandleCellarOpen);
    }
    protected override void OnStart()
    {
        base.OnStart();

        m_moveDistance = (4.47f - 4.14f) / m_dropDownTime;

        GlobalEvent.AddEvent("WeightDropDown", HandleWeightDropDown);
    }
예제 #11
0
    public void AddEventListener(Enum EventEnum, EventHandle handle)
    {
        EventHandRegisterInfo info = new EventHandRegisterInfo();
        info.m_EventKey = EventEnum;
        info.m_hande = handle;

        GlobalEvent.AddEvent(EventEnum, handle);

        m_EventListeners.Add(info);
    }
예제 #12
0
    private void OnEnable()
    {
        if (editor == null)
        {
            editor = new TableDataEditor();
        }
        editor.Init(this);

        GlobalEvent.AddEvent(EditorEvent.LanguageDataEditorChange, Refresh);
    }
예제 #13
0
    void Start()
    {
        if (m_text == null)
        {
            m_text = GetComponent <Text>();
        }

        ResetLanguage();
        GlobalEvent.AddEvent(LanguageEventEnum.LanguageChange, ReceviceLanguageChange);
    }
예제 #14
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);
    }
예제 #15
0
    void OnEnable()
    {
        EditorGUIStyleData.Init();

        GlobalEvent.AddTypeEvent <SyncEntityMsg>(ReceviceSyncEntity);
        GlobalEvent.AddTypeEvent <PursueMsg>(RecevicePursueMsg);
        GlobalEvent.AddTypeEvent <ChangeSingletonComponentMsg>(ReceviceChangeSingletonCompMsg);
        GlobalEvent.AddTypeEvent <StartSyncMsg>(ReceviceStartSyncMsg);
        GlobalEvent.AddTypeEvent <AffirmMsg>(ReceviceAffirmMsg);
        GlobalEvent.AddTypeEvent <CommandComponent>(ReceviceCommandMsg);

        GlobalEvent.AddEvent(SyncDebugSystem.c_isAllMessage, ReceviceAllMsg);
        GlobalEvent.AddEvent(SyncDebugSystem.c_isConflict, ReceviceConflict);
        GlobalEvent.AddEvent(SyncDebugSystem.c_Recalc, ReceviceRecalc);
    }
예제 #16
0
    private void CreateUI(string UIName)
    {
        isCreating = true;
        GlobalEvent.AddEvent(EditorGlobalEventEnum.OnCreateAsset, (param) =>
        {
            Debug.Log("OnCreateAsset");
            isCtreatingPrefab   = true;
            showProgressContent = "创建预制";
            progress            = 0.5f;
        }, true);

        CreateUIScript(UIName);
        showProgressContent = "创建脚本";
        progress            = 0.25f;
    }
예제 #17
0
    /// <summary>
    /// 全查表
    /// </summary>
    public static void PreLoad()
    {
        //清理缓存
        if (!s_isInit)
        {
            s_isInit = true;
            GlobalEvent.AddEvent(MemoryEvent.FreeHeapMemory, CleanCache);
        }

        DataTable data = GetDataTable();

        for (int i = 0; i < data.TableIDs.Count; i++)
        {
            GetData(data.TableIDs[i]);
        }
    }
예제 #18
0
    /// <summary>
    /// 全查表
    /// </summary>
    public static void PreLoad()
    {
        //清理缓存
        if (!s_isInit)
        {
            s_isInit = true;
            GlobalEvent.AddEvent(MemoryEvent.FreeHeapMemory, CleanCatch);
        }

        string dataName = typeof(T).Name.Replace("Generate", "");

        DataTable data = DataManager.GetData(dataName);

        for (int i = 0; i < data.TableIDs.Count; i++)
        {
            GetData(data.TableIDs[i]);
        }
    }
예제 #19
0
    public override void Init()
    {
        m_SDKName = "PublicPayClass";
        storeName = (StoreName)Enum.Parse(typeof(StoreName), SDKManager.GetProperties(SDKInterfaceDefine.PropertiesKey_StoreName, "None"));

        //有其他的payClass符合就不启动public pay
        if (!SDKManager.GetHasPayService(storeName.ToString()))
        {
            GlobalEvent.AddTypeEvent <PrePay2Client>(OnPrePay);

            Debug.Log("PublicPayClass Init m_SDKName:>" + m_SDKName + "<");
        }

        GlobalEvent.AddEvent(StoreName.WX, null);

        //GlobalEvent.DispatchEvent("Fight",)

        GlobalEvent.DispatchTypeEvent <InputUIOnClickEvent>(null);

        GlobalEvent.AddTypeEvent <InputUIOnClickEvent>((e, objs) => {
        });

        SDKManager.GoodsInfoCallBack += OnGoodsInfoCallBack;
    }
예제 #20
0
    private void Start()
    {
        //init
        GlobalEvent.Init();

        //dispatch string
        GlobalEvent.AddEvent(GameEnums.Hello, Say_Hello_A);
        GlobalEvent.DispatchEvent(GameEnums.Hello, "Hello!");
        GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A);

        //dispathc class
        GlobalEvent.AddEvent(GameEnums.Hello, Say_Hello_B);
        GlobalEvent.DispatchEvent(GameEnums.Hello, EventData.New(new Dictionary <string, object>
        {
            { "pos", Vector2.zero },
            { "id", 120 }
        }));

        GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_B);

        GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A);
        GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A);
        GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A);
    }
예제 #21
0
 void Start()
 {
     UpdateOffset();
     GlobalEvent.AddEvent("ShakeCamera", ShakeCamera);
 }
예제 #22
0
    private void NewTableConfig()
    {
        GUILayout.BeginHorizontal("box");
        newFileName = EditorDrawGUIUtil.DrawBaseValue("新建配置文件:", newFileName).ToString();
        if (GUILayout.Button("确定", GUILayout.Width(50)))
        {
            if (ResourcePathManager.ContainsFileName(newFileName) || string.IsNullOrEmpty(newFileName))
            {
                EditorUtility.DisplayDialog("警告", "名字不能为空或重复", "OK");
            }
            else
            {
                chooseFileName = newFileName;
                fileNames.Add(newFileName);
            }
        }

        GUILayout.EndHorizontal();

        if (string.IsNullOrEmpty(newFileName))
        {
            return;
        }
        if (ResourcePathManager.ContainsFileName(newFileName))
        {
            EditorGUILayout.HelpBox("文件名重复!!", MessageType.Error);
            return;
        }
        if (newConfigInfo == null)
        {
            newConfigInfo = new TableConfigOtherInfo();
        }

        newConfigInfo.configDescription = EditorDrawGUIUtil.DrawBaseValue("配置文件描述:", newConfigInfo.configDescription).ToString();
        GUILayout.Space(5);
        GUILayout.BeginHorizontal("box");
        GUILayout.Box("添加字段:");
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("+", GUILayout.Width(50)))
        {
            TableConfigFieldInfo f = new TableConfigFieldInfo();
            f.fieldName = "NewField" + newConfigInfo.fieldInfoDic.Count;
            while (newConfigInfo.fieldInfoDic.ContainsKey(f.fieldName))
            {
                f.fieldName += "_0";
            }
            newConfigInfo.fieldInfoDic.Add(f.fieldName, f);
        }
        GUILayout.EndHorizontal();

        DrawFieldData(newConfigInfo);

        if (newConfigInfo.fieldInfoDic.Count > 0 && GUILayout.Button("创建"))
        {
            GlobalEvent.AddEvent(EditorGlobalEventEnum.OnResourcesAssetsChange, (t) =>
            {
                Debug.Log("OnResourcesAssetsChange");
                AssetsSortManagement.SetLayer(newFileName, configLayerName);
                AssetsSortManagement.Save();

                newFileName   = "";
                newConfigInfo = null;
            }, true);
            string content = TableConfigTool.ConfigInfo2TableText(newConfigInfo, null);
            string path    = CreateConfigClassEditor.SaveConfigFilePath + "/" + newFileName + ".txt";
            FileUtils.CreateTextFile(path, content);
            CreateConfigClassEditor.CreateConfigClassFile(content, newFileName);
            AssetDatabase.Refresh();
        }
    }
예제 #23
0
 private void Start()
 {
     GlobalEvent.AddEvent(CameraMovement.CameraEvn.ToFont, ToFontFun);
 }
예제 #24
0
    void ShowAllMapInfoGUI()
    {
        List <MapInfomation> mapInfos = new List <MapInfomation>(MapManager.MapInfosDic.Values);

        pos = GUILayout.BeginScrollView(pos, true, true);
        foreach (MapInfomation info in mapInfos)
        {
            bool isOpen = (currentLoadMap == info);

            if (isOpen)
            {
                GUI.color = Color.red;
            }



            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical("box");
            GUILayout.Label("ID: " + info.id);
            //GUILayout.Label("Scene: " + info.sceneName);
            GUILayout.Label("MapFile: " + info.mapFileName);
            GUILayout.Space(4);
            GUILayout.Box("Light Map :");
            info.isCreateLightMap = (bool)EditorDrawGUIUtil.DrawBaseValue("是否生成光照贴图", info.isCreateLightMap);
            if (info.isCreateLightMap)
            {
                info.lightMapSize = EditorGUILayout.IntPopup("光照贴图单张最大尺寸:", info.lightMapSize, lightMapSizeNames, lightMapSizeValue);
                LightmapEditorSettings.maxAtlasHeight = info.lightMapSize;
                LightmapEditorSettings.maxAtlasWidth  = info.lightMapSize;
                GUILayout.Label("光照贴图文件: " + info.mapLightMap);
            }

            GUILayout.Space(4);

            GUILayout.Label("Collider File :" + info.mapColliderInfoFileName);

            GUILayout.EndVertical();
            GUILayout.BeginVertical("box");
            if (GUILayout.Button(isOpen?"卸载地图": "加载地图", GUILayout.Width(120)))
            {
                if (!isOpen)
                {
                    if (currentLoadMap != null)
                    {
                        if (EditorUtility.DisplayDialog("警告", "是否切换地图,请记得先保存!", "OK", "Cancel"))
                        {
                            MapManager.DestoryMapGameObjectInScene(currentLoadMap.id);
                            currentLoadMap = null;
                        }
                        else
                        {
                            return;
                        }
                    }
                    currentLoadMap = info;
                    MapManager.CreateMapGameObjectInScene(info.id);
                    GetCurrentEditMapRoot();
                }
                else
                {
                    if (EditorUtility.DisplayDialog("警告", "是否卸载地图,请记得先保存!", "OK", "Cancel"))
                    {
                        MapManager.DestoryMapGameObjectInScene(info.id);
                        currentLoadMap = null;
                    }
                }
            }

            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.Space(5);
            if (currentLoadMap == null && GUILayout.Button("删除"))
            {
                if (EditorUtility.DisplayDialog("警告", "是否删除地图:" + info.mapFileName, "OK", "Cancel"))
                {
                    MapManager.MapInfosDic.Remove(info.id);
                    GlobalEvent.AddEvent(EditorGlobalEventEnum.OnResourcesAssetsChange, (t) =>
                    {
                        Initialize();
                    }, true);
                    SaveMapInfoData();

                    FileUtils.DeleteFile(MapUseConstValues.MapDataDirectory + info.mapFileName + "/" + info.mapFileName + ".txt");
                    AssetDatabase.Refresh();
                    return;
                }
            }

            GUI.color = oldColor;
        }
        GUILayout.EndScrollView();
    }
 private void HandleBookCaseDown(params object[] args)
 {
     GlobalEvent.AddEvent("WeightDropDown", HandleDropDownLogic);
 }
예제 #26
0
    static void RunEditor()
    {
        GlobalEvent.AddEvent(EditorGlobalEventEnum.OnResourcesAssetsChange, OnResourcesChange);

        UnityLayerTagUtils.AddLayer(MapObjectLayer);
    }
예제 #27
0
 public void Init()
 {
     GlobalEvent.AddEvent(LanguageEventEnum.LanguageChange, ReceviceLanguageChange);
     ResetLanguage();
 }