Ejemplo n.º 1
0
        public override void CreateGameObject(System.Action <MPObject> loadFinish)
        {
            XYCoroutineEngine.Execute(LoadRoleObject(string.Format(MapPlacementController.mapRoleObjectResLoadPathStrFormat, apprId), loadFinish));
            return;

            //this.mapGO = ModuleFactory.CreateBaseRole( sn.ToString(), this.roleCfg.roleBone );
            if (this.reference.Apprid <= 0)
            {
                base.CreateGameObject(loadFinish);
                return;
            }

            BaseObject bco = new BaseObject(ResourceManager.GetRoleConfig(this.reference.Apprid));

            //bco.UpdateEquip();
            this.mapGO = bco;
            if (this.mapGO.name != "BaseObject_NoRoleConfig")
            {
                this.mapGO.name = sn.ToString();
            }
            GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

            cube.transform.parent           = this.mapGO.transform;
            cube.transform.localPosition    = Vector3.zero;
            cube.transform.localEulerAngles = Vector3.zero;
            cube.transform.localScale       = new Vector3(1, 2, 1);

            BoxCollider bc = this.mapGO.AddComponent(typeof(BoxCollider)) as BoxCollider;

            bc.size   = new Vector3(1, 2, 1);
            bc.center = new Vector3(0, 1, 0);

            XYClientCommon.ChangeLayer(this.mapGO, XYDefines.Layer.Player, true);
            //return this.mapGO;
        }
Ejemplo n.º 2
0
    void OnLevelWasLoaded()
    {
        GameObject[] Terrains = GameObject.FindGameObjectsWithTag("Terrain");
        if (Terrains != null)
        {
            for (int i = 0; i < Terrains.Length; i++)
            {
                Renderer renderer = Terrains[i].GetComponent <Renderer>();
                if (!renderer)
                {
                    continue;
                }
                renderer.sharedMaterial.shader = Shader.Find(renderer.sharedMaterial.shader.name);
            }
        }
        Light light = GameObject.FindObjectOfType <Light>();

        if (light != null)
        {
            light.cullingMask = 0;
        }
        var ca = SetupCamera();

        var root = GameObject.FindGameObjectWithTag("root");

        ReplaceShader(root, string.Empty);
        var config = root.GetComponent <SceneConfig>();

        CloseRender(config.Mainbuilding);
        CloseRender(config.Other);
        XYCoroutineEngine.Execute(LoadSceneAsset(config.Mainbuilding));
        XYCoroutineEngine.Execute(LoadSceneAsset(config.Other));

        AddMapPlacementComponents(ca);
    }
    void BaseSettingWindow(int wndID)
    {
        try{
            GUILayout.Label(string.Format("{0} ** {1}", curMap.Name, ""));
            GUILayout.BeginHorizontal();
            RenderSettings.fog = GUILayout.Toggle(RenderSettings.fog, "雾");
            if (quitConfirm_.OnDraw())
            {
                SceneManager.LoadScene("startMenu");
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (saveToJsonConfirm_.OnDraw())
            {
                //SaveToXml( string.Format( "res/data/{0}.map.xml", curMap.ConfigFileName ) );
                SaveToJson(string.Format(mapObjectConfigsDailySavePath, curMap.ID, DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute));
                SaveToJson(string.Format(mapObjectConfigsSavePath, curMap.ID));
            }
            if (loadFromXmlConfirm_.OnDraw())
            {
                ClearAllData();
                XYCoroutineEngine.Execute(LoadFromJson(String.Format(mapObjectConfigsSavePath, curMap.ID)));
                //LoadFromXml( string.Format( "res/data/{0}.map.xml", curMap.ConfigFileName ) );
            }
            GUILayout.EndHorizontal();

            //GUILayout.BeginHorizontal();
            //if ( saveToTextConfirm_.OnDraw() ) {
            //    SaveToText();
            //}
            //if ( loadFromTextConfirm_.OnDraw() ) {
            //    ClearAllData();
            //    LoadFromText();
            //}
            //GUILayout.EndHorizontal();

            if (GUILayout.Button("空气墙"))
            {
                showAirWall_ = !showAirWall_;
                XYClientCommon.AirWall.EnableRender(showAirWall_);
            }
            //GUILayout.Label( string.Format( "对象统计:{0}/{1}", this.mapObjs_.Count, curMap.ObjCount ) );
            GUILayout.Label(string.Format("对象统计:{0}", this.mapObjs_.Count));
            if (GUILayout.Button("位置检查"))
            {
                CheackInvalidPos();
            }
            if (GUILayout.Button("移除非法物体"))
            {
                RemoveInvalidGo();
            }
            GUI.DragWindow(new Rect(0, 0, 10000, 20));
        }
        catch (System.Exception exc) {
            Debug.Log(exc.Message);
            Debug.Log(exc.StackTrace);
        }
    }
Ejemplo n.º 4
0
 private void Init()
 {
     XYDirectory.Init();
     XYCoroutineEngine.Load();
     XYSingleAssetLoader.Init();
     Loader.Init();
     TimelineManager.Init();
     World.Init();
 }
Ejemplo n.º 5
0
    public void CreatEffect(string name, Action <EffectObject> loadFinish, bool isUIEffect)
    {
        string path = string.Format("res/effect/{0}.go", name);

        if (isUIEffect)
        {
            path = string.Format("res/effect/ui/{0}.go", name);
        }
        XYCoroutineEngine.Execute(LoadEffect(path, loadFinish));
    }
Ejemplo n.º 6
0
 public void CreatAniClips(string path, Action <AnimationClip> loadFinish)
 {
     aniClipQueue.Enqueue(path);
     loadFinishQueue.Enqueue(loadFinish);
     if (curAniWWW == null)
     {
         aniClipQueue.Dequeue();
         loadFinishQueue.Dequeue();
         XYCoroutineEngine.Execute(LoadAniClip(path, loadFinish));
     }
 }
Ejemplo n.º 7
0
    public override void OnBehaviourStart(Playable playable)
    {
        //return;
        roleEffectBehaviour = behaviour as RoleEffectBehaviour;
        RoleObject obj = World.Instance.GetRoleObj(roleEffectBehaviour.roleData);

        if (obj != null)
        {
            var renders = obj.gameObject.GetComponentsInChildren <SkinnedMeshRenderer>();
            XYCoroutineEngine.Execute(DoDissolveEffect(renders.ToList()));
        }
    }
Ejemplo n.º 8
0
    private IEnumerator LoadAniClip(string path, Action <AnimationClip> loadFinish)
    {
        curAniWWW = TLEditorWww.Create(path);
        while (!curAniWWW.Finished)
        {
            yield return(null);
        }
        AnimationClip clip = curAniWWW.GetAsset() as AnimationClip;

        yield return(null);

        curAniWWW.Unload();
        loadFinish(clip);
        curAniWWW = null;
        if (aniClipQueue.Count > 0)
        {
            XYCoroutineEngine.Execute(LoadAniClip(aniClipQueue.Dequeue(), loadFinishQueue.Dequeue()));
        }
    }
Ejemplo n.º 9
0
    public static IEnumerator LoadLevel(string levelname, MapReference mf)
    {
        if (!instance_)
        {
            yield break;
        }
        isSceneTexLoadComplete = false;
        instance_.mapref       = mf;
        XYCoroutineEngine.Execute(LoadShader(shaderPath));
        while (!instance_.myshaderLoadDone)
        {
            yield return(null);
        }

        XYCoroutineEngine.Execute(LoadPublic(PublicPath));
        while (!instance_.PublicLoadDone)
        {
            yield return(null);
        }
        XYCoroutineEngine.Execute(LoadNormal(NormalPath));
        while (!instance_.NormalLoadDone)
        {
            yield return(null);
        }
        XYCoroutineEngine.Execute(LoadTexture(TexturePath));
        while (!instance_.TextureLoadDone)
        {
            yield return(null);
        }

        XYCoroutineEngine.Execute(LoadCtrl(CtrlAssets));
        while (!isCtrlLoadDone)
        {
            yield return(null);
        }
        XYCoroutineEngine.Execute(LoadSceneTex(levelname));
        while (!isSceneTexLoadComplete)
        {
            yield return(null);
        }
        XYCoroutineEngine.Execute(LoadScene(levelname));
    }
Ejemplo n.º 10
0
 private void NpcPlacementWindow(int winID)
 {
     if (mrs_ != null)
     {
         scrollPosition_ = GUILayout.BeginScrollView(scrollPosition_);
         {
             foreach (MapReference mr in mrs_)
             {
                 string showName = string.Format("{0}_{1}", mr.ID, mr.Name);
                 if (GUILayout.Button(showName))
                 {
                     MapPlacementController.curMap = mr;
                     XYCoroutineEngine.Execute(GameManager.LoadLevel(mr.FileName, mr));
                 }
             }
         }
         GUILayout.EndScrollView();
     }
     GUI.DragWindow(new Rect(0, 0, 1000, 20));
 }
Ejemplo n.º 11
0
    void OnLevelWasLoaded()
    {
        LevelWasLoaded = false;
        if (SceneManager.GetActiveScene().name != "AsyncLevelLoader" &&
            SceneManager.GetActiveScene().name != "startMenu")
        {
            LevelWasLoaded = true;
        }

        var root = GameObject.FindGameObjectWithTag("root");

        MapPlacement.MPObject.ReplaceShader(root, string.Empty);

        var config = root.GetComponent <SceneConfig>();

        CloseRender(config.Mainbuilding);
        CloseRender(config.Other);
        RenderSettings.fog = false;
        XYCoroutineEngine.Execute(LoadSceneAsset(config.Mainbuilding));
        XYCoroutineEngine.Execute(LoadSceneAsset(config.Other));
    }
Ejemplo n.º 12
0
 private void Awake()
 {
     instance_ = this;
 }
Ejemplo n.º 13
0
 private void Awake()
 {
     XYDirectory.Init();
     XYCoroutineEngine.Load();
     SceneManager.sceneLoaded += OnSceneLoaded;
 }
Ejemplo n.º 14
0
    //private IEnumerator LoadRoleObject(string path, Action<RoleObject> loadFinish)
    //{
    //    UnityEngine.Object role = null;
    //    TLEditorWww roleWww = TLEditorWww.Create(path);

    //    roleWww = TLEditorWww.Create(path);

    //    while (!roleWww.Finished)
    //        yield return null;

    //    role = roleWww.GetAsset() as GameObject;
    //    GameManager.ReplaceShader(role, string.Empty);

    //    if (role == null)
    //        Debug.LogError("Error, Load role Failed: " + path);
    //    else
    //    {
    //        Role roleConfig = (role as GameObject).GetComponent<Role>();
    //        if (roleConfig == null)
    //            Debug.Log("config==null");
    //        GameObject roleGo = ModelLoader.CreateRole(roleConfig).gameObject;
    //        var performer = roleGo.GetComponent<ActionPerformer>();
    //        RoleObject roleObj = roleGo.GetComponent<RoleObject>();
    //        roleObj.needAnimationButtonGui = false;
    //        roleObj.CheckAnimator();
    //        roleObj.enabled = true;
    //        //roleWww.Unload();
    //        loadFinish(roleObj);
    //    }
    //}


    public void CreatTimeline(string name, Action <RoleObject> loadFinish)
    {
        XYCoroutineEngine.Execute(LoadTimeline(string.Format("res/timeline/{0}.timeline", name), loadFinish));
    }
Ejemplo n.º 15
0
 public virtual void CreateGameObject(System.Action <MPObject> loadFinish)
 {
     XYCoroutineEngine.Execute(LoadRoleObject(string.Format(MapPlacementController.mapRoleObjectResLoadPathStrFormat, apprId), loadFinish));
 }
Ejemplo n.º 16
0
 public void CreatAudioClips(string name, Action <AudioClip> loadFinish)
 {
     XYCoroutineEngine.Execute(LoadAudioClip(string.Format("res/audio/{0}.audio", name), loadFinish));
 }
Ejemplo n.º 17
0
 public void CreatTexture(string name, Action <Texture> loadFinish)
 {
     XYCoroutineEngine.Execute(LoadTexture(string.Format("res/ui/tex/{0}.tex", name), loadFinish));
 }
Ejemplo n.º 18
0
 public void CreatAction(string actionName, Action <ModelAction> loadFinish)
 {
     XYCoroutineEngine.Execute(LoadActionObject(string.Format("res/action/{0}.action", actionName), loadFinish));
 }
Ejemplo n.º 19
0
 public static void LoadModel(ObjectModel model)
 {
     XYCoroutineEngine.Execute(AsyncLoadModel(model));
 }
Ejemplo n.º 20
0
 /// <summary>
 ///     预加载一些资源和设置
 /// </summary>
 public static void Initialize()
 {
     XYCoroutineEngine.Execute(AsyncPreloadRoleConfig(0.25f));
     XYCoroutineEngine.Execute(AsyncPreloadEquipConfig(0.25f));
     XYCoroutineEngine.Execute(AsyncPreloadRoleBone(0.5f));
 }
Ejemplo n.º 21
0
 public static void ClearTimeOut()
 {
     XYCoroutineEngine.Execute(DoClearTimeout(false));
 }
Ejemplo n.º 22
0
 public static void UnloadUnusedAssets()
 {
     XYCoroutineEngine.Execute(AsyncUnloadUnusedAssets());
 }
Ejemplo n.º 23
0
 private void Init()
 {
     XYDirectory.Init();
     XYCoroutineEngine.Load();
     XYSingleAssetLoader.Init();
 }
Ejemplo n.º 24
0
 public void CreateRoleObject(int apprid, Action <RoleObject> loadFinish)
 {
     XYCoroutineEngine.Execute(LoadRoleObject(string.Format("res/role/{0}.role", apprid), loadFinish));
 }