Example #1
0
    public void Initialize()
    {
        _cameraObject = GameObject.Find(@"Main Camera");

        if (_cameraObject != null)
        {
            _camera          = _cameraObject.GetComponent <Camera>();
            _cameraTransform = _cameraObject.transform;

            XResources.Destroy(_dummyObject);

            _dummyObject      = XResources.Load <GameObject>("Prefabs/DummyCamera", AssetType.Prefab);
            _dummyObject.name = "Dummy Camera";

            _dummyCamera = _dummyObject.transform.GetChild(0);
            _ator        = _dummyObject.GetComponent <Animator>();
            _overrideController.runtimeAnimatorController = _ator.runtimeAnimatorController;
            _ator.runtimeAnimatorController = _overrideController;

            _root_pos_inited      = false;
            _idle_root_pos_inited = false;
            _status               = XCameraExStatus.Idle;
            _status_changed       = false;
            _idle_root_rotation_y = 0;
        }
    }
Example #2
0
    public void Effect(XCameraMotionData motion, bool overrideclip)
    {
        //must be called from UPDATE pass
        AnimationClip clip = XResources.Load <AnimationClip>(motion.Motion3D, AssetType.Anim);

        if (clip != null)
        {
            _trigger = "ToEffect";
            if (overrideclip && _overrideController["CameraEffect"] != clip)
            {
                _overrideController["CameraEffect"] = clip;
            }

            _motion.LookAt_Target   = motion.LookAt_Target;
            _motion.Follow_Position = true;
            _motion.Coordinate      = CameraMotionSpace.World;

            switch (motion.Motion3DType)
            {
            case CameraMotionType.AnchorBased:
                _motion.AutoSync_At_Begin = true;
                _motion.LookAt_Target     = false;
                break;

            case CameraMotionType.CameraBased:
                _motion.AutoSync_At_Begin = false;
                break;
            }
            _motion.Motion = motion.Motion3D;
        }
    }
Example #3
0
        private static bool _SaveMountAssett(GameObject fbx, ModelImporter modelImporter, string path)
        {
            string     saveRootPath = "Assets/Resources/Prefabs/Equipment/";
            GameObject go           = GameObject.Instantiate(fbx) as GameObject;

            Renderer[] renders = go.GetComponentsInChildren <Renderer>();
            Shader     shader  = Shader.Find("Custom/Common/MobileDiffuse");

            foreach (Renderer r in renders)
            {
                r.lightProbeUsage   = LightProbeUsage.BlendProbes;
                r.shadowCastingMode = ShadowCastingMode.Off;
                r.receiveShadows    = false;
                foreach (Material mat in r.sharedMaterials)
                {
                    mat.shader = shader;
                }
            }

            Animator animator = go.GetComponent <Animator>();

            animator.runtimeAnimatorController = XResources.Load <RuntimeAnimatorController>("Controller/XMinorAnimator", AssetType.Controller);
            go.layer = LayerMask.NameToLayer("Role");
            PrefabUtility.CreatePrefab(saveRootPath + fbx.name + ".prefab", go, ReplacePrefabOptions.ReplaceNameBased);
            GameObject.DestroyImmediate(go);
            modelImporter.isReadable = false;
            return(true);
        }
    public override void OnXGUI()
    {
        if (CreateSpaceButton("Save Asset"))
        {
            XResources.SaveAll();
        }

//		DoButton("Get Cursor EditorIcon", ()=> isShowIcons = !isShowIcons);
//
//		if(isShowIcons) ShowAllIcon();
        BeginHorizontal();

        DoButton("persistentDataPath", () => {
            EditorUtility.RevealInFinder(Application.persistentDataPath);
        });
        DoButton("temporaryCachePath", () => {
            EditorUtility.RevealInFinder(Application.temporaryCachePath);
        });
        DoButton("dataPath", () => {
            EditorUtility.RevealInFinder(Application.dataPath);
        });
        DoButton("streamingAssetsPath", () => {
            EditorUtility.RevealInFinder(Application.streamingAssetsPath);
        });

        string time = System.DateTime.Now.ToString();

        EndHorizontal();

        Time.timeScale = CreateFloatField("TimeScale", Time.timeScale);

        Application.targetFrameRate = CreateIntField("FrameRate", Application.targetFrameRate);
    }
Example #5
0
    private void LoadRoot()
    {
        GameObject temp = GameObject.Find("UIRoot");

        if (temp != null)
        {
            GameObject.Destroy(temp);
        }
        string     rootpath = "UI/UIRoot";
        GameObject go       = XResources.Load <GameObject>(rootpath, AssetType.Prefab);

        GameObject.DontDestroyOnLoad(go);

        _uiCamera   = go.GetComponent <Camera>();
        _canvas     = go.transform.GetChild(0).GetComponent <Canvas>();
        _fade       = _canvas.transform.GetChild(0).GetComponent <Image>();
        _fade.color = new Color(1, 1, 1, 0);
        _loadimg    = _canvas.transform.GetChild(1).GetComponent <Image>();
        _loadtxt    = _loadimg.transform.GetChild(0).GetComponent <Text>();
        XLoading.Show(true);
        XTableMgr.tableLoaded += XLoading.OnLoadFinish;
        go = new GameObject("EventSystem");
        go.AddComponent <EventSystem>();
        go.AddComponent <StandaloneInputModule>();
        GameObject.DontDestroyOnLoad(go);
    }
Example #6
0
    public void OverrideAnimClip(string motion, string clipname)
    {
        //get override clip
        AnimationClip animClip = XResources.Load <AnimationClip>(clipname, AssetType.Anim);

        OverrideAnimClip(motion, animClip);
    }
Example #7
0
    public void Initial(GameObject camera)
    {
        base.Initilize();
        _cameraObject    = camera;
        _cameraTransform = camera.transform;
        if (_cameraObject != null)
        {
            _camera         = _cameraObject.GetComponent <Camera>();
            _camera.enabled = true;

            if (_dummyObject == null)
            {
                _dummyObject      = XResources.Load <GameObject>("Prefabs/DummyCamera", AssetType.Prefab);
                _dummyObject.name = "Dummy Camera";
            }
            _dummyCamera = _dummyObject.transform.GetChild(0);
            _ator        = _dummyObject.GetComponent <Animator>();
            if (_overrideController == null)
            {
                _overrideController = new AnimatorOverrideController();
            }
            _overrideController.runtimeAnimatorController = _ator.runtimeAnimatorController;
            _ator.runtimeAnimatorController = _overrideController;
        }
    }
Example #8
0
    private IEnumerator PreLoadMonster()
    {
        XLevelSpawnInfo spawner = XLevelSpawnMgr.singleton.currSpawn;

        if (spawner != null)
        {
            _sub_progress = 0;
            float per = 1f / spawner.preloadInfo.Count;
            foreach (var item in spawner.preloadInfo)
            {
                var entity = XTableMgr.GetTable <XEntityStatistics>().GetByID(item.Key);
                if (entity == null)
                {
                    continue;
                }
                var pres = XTableMgr.GetTable <XEntityPresentation>().GetItemID(entity.PresentID);
                if (pres == null)
                {
                    continue;
                }
                XResources.CreateInAdvance("Prefabs/" + pres.Prefab, item.Value);
                _sub_progress += per;
                yield return(null);
            }
        }
    }
Example #9
0
    static void OnInitCallback(byte t, IntPtr ptr)
    {
        string command = Marshal.PtrToStringAnsi(ptr);

        switch (t)
        {
        case ASCII.L:
            XDebug.CLog(command);
            break;

        case ASCII.W:
            XDebug.CWarn(command);
            break;

        case ASCII.E:
            XDebug.CError(command);
            break;

        case ASCII.G:
            GameObject go = XResources.Load <GameObject>(command, AssetType.Prefab);
            go.name = command;
            break;

        case ASCII.U:
            XDebug.CLog("unload: " + command);
            break;

        default:
            XDebug.LogError(t + " is not parse symbol: " + command);
            break;
        }
    }
Example #10
0
 private void TailResult(bool present)
 {
     if (_data.Skill.Result[_data.Sequnce].LongAttackData.TriggerAtEnd)
     {
         if (_data.Warning)
         {
             _bullet.transform.position = _data.WarningPos;
         }
         Result(null);
     }
     if (!present)
     {
         return;
     }
     if (!string.IsNullOrEmpty(_data.Skill.Result[_data.Sequnce].LongAttackData.End_Fx))
     {
         GameObject fx  = XResources.Load <GameObject>(_data.Skill.Result[_data.Sequnce].LongAttackData.End_Fx, AssetType.Prefab);
         Vector3    pos = _bullet.transform.position;
         if (_data.Skill.Result[_data.Sequnce].LongAttackData.EndFx_Ground)
         {
             pos.y = 0;
         }
         fx.transform.position = pos;
         fx.transform.rotation = _bullet.transform.rotation;
         XResources.Destroy(fx, _data.Skill.Result[_data.Sequnce].LongAttackData.EndFx_LifeTime);
     }
     if (_data.Firer.ShownTransform == _bullet.transform)
     {
         _data.Firer.ShownTransform = _data.Firer.Transform;
     }
 }
Example #11
0
    public void PlayHitFx(Transform trans, string fx, bool follow)
    {
        if (string.IsNullOrEmpty(fx))
        {
            return;
        }

        hit_fx      = XResources.Load <GameObject>(fx, AssetType.Prefab);
        binded_bone = trans.Find("Bip001/Bip001 Pelvis/Bip001 Spine");
        Transform parent = (binded_bone == null) ? trans : binded_bone;

        if (follow)
        {
            hit_fx.transform.parent        = parent;
            hit_fx.transform.localPosition = Vector3.zero;
            hit_fx.transform.localRotation = Quaternion.identity;
            hit_fx.transform.localScale    = Vector3.one;
        }
        else
        {
            hit_fx.transform.position = parent.position;
            hit_fx.transform.rotation = parent.rotation;
        }

        ParticleSystem[] systems = hit_fx.GetComponentsInChildren <ParticleSystem>();
        foreach (ParticleSystem system in systems)
        {
            system.Play();
        }
    }
Example #12
0
 public XActor(string prefab, float x, float y, float z, string clip)
 {
     _go = XResources.Load<GameObject>(prefab, AssetType.Prefab);
     _go.transform.position = new Vector3(x, y, z);
     _go.transform.rotation = Quaternion.identity;
     _ator = _go.GetComponent<Animator>();
     if (_ator != null) MakeActor(clip);
 }
Example #13
0
 public XActor(float x, float y, float z, string clip)
 {
     string path = @"Prefabs/Player";
     _go = XResources.Load<GameObject>(path, AssetType.Prefab);
     _go.transform.position = new Vector3(x, y, z);
     _ator = _go.GetComponent<Animator>();
     if (_ator != null) MakeActor(clip);
 }
    static void SetPath()
    {
        var folder = EditorUtility.OpenFolderPanel("Path", projectPath, "WuxingogoExtension");

        XLogger.Log(folder);
        projectPath = folder;
        XResources.InitTexture();
    }
Example #15
0
 public static void SetImage(string name)
 {
     if (loadimg != null)
     {
         Sprite spr = XResources.Load <Sprite>(name, AssetType.PNG);
         loadimg.sprite = spr;
     }
 }
Example #16
0
 void Start()
 {
     option = new GUILayoutOption[] { GUILayout.Width(140), GUILayout.Height(80) };
     GameEnine.SetMonoForTest(this);
     XTimerMgr.singleton.Init();
     XConfig.Initial(LogLevel.Log, LogLevel.Error);
     XGlobalConfig.Initial();
     XResources.Init();
 }
Example #17
0
 public override void Reset()
 {
     base.Reset();
     if (goInstance != null)
     {
         XResources.Destroy(goInstance);
     }
     transferRef = false;
 }
Example #18
0
 public void UnloadEntity()
 {
     OnUnintial();
     _attr = null;
     XResources.Destroy(_object);
     _object = null;
     DetachAllComponents();
     base.Unload();
 }
Example #19
0
    public void LoadDlg(IUIDlg dlg)
    {
        if (!Exist(dlg))
        {
            if (m_recycle == null)
            {
                m_recycle = new Dictionary <uint, IUIDlg>();
            }
            if (m_recycle.ContainsKey(dlg.id))
            {
                m_recycle.Remove(dlg.id);
                dlg.innerBehaviour.gameObject.SetActive(true);
            }
            else
            {
                GameObject go = XResources.Load <GameObject>(dlg.fileName, AssetType.Prefab);
                go.transform.SetParent(dlg.shareCanvas ? _canvas.transform : _uiCamera.transform);
                if (!dlg.shareCanvas)
                {
                    Canvas cans = go.GetComponent <Canvas>();
                    if (cans != null)
                    {
                        cans.worldCamera = _uiCamera;
                    }
                }
                go.transform.localPosition = Vector3.zero;
                go.transform.localRotation = Quaternion.identity;
                go.transform.localScale    = Vector3.one;
                dlg.SetBehaviour(go);
                dlg.OnLoad();
            }
            if (dlg.pushStack)
            {
                m_stack.Push(dlg);
                _sort = dlg.innerBehaviour.SortDepth(_sort) + _gap;
                dlg.OnShow();
            }
            else
            {
                m_list.Add(dlg);
            }
        }
        if (!dlg.pushStack) //不在栈中的ui 每次调用的时候都展示在最前 不管之前是否cache
        {
            if (dlg.type == DlgType.Top)
            {
                dlg.innerBehaviour.SortDepth(_top);
            }
            else if (dlg.type == DlgType.Surface)
            {
                _sort = dlg.innerBehaviour.SortDepth(_sort) + _gap;
            }

            dlg.OnShow();
        }
    }
Example #20
0
    public void OverrideAnim(string key, string clippath)
    {
        if (string.IsNullOrEmpty(clippath) || m_Animator == null || m_overrideController == null)
        {
            return;
        }
        AnimationClip clip = XResources.Load <AnimationClip>("Animation/" + clippath, AssetType.Anim);

        OverrideAnim(key, clip);
    }
Example #21
0
 public XBullet(XBulletData data)
 {
     _data    = data;
     _elapsed = 0.0f;
     _hits    = data.Hits;
     _bullet  = XResources.Load <GameObject>(data.Prefab, AssetType.Prefab);
     _bullet.transform.position = _data.BulletRay.origin;
     _bullet.transform.rotation = _data.Velocity > 0 ? Quaternion.LookRotation(_data.BulletRay.direction) : Quaternion.LookRotation(_data.Firer.Transform.forward);
     _data.Firer.ShownTransform = _bullet.transform;
 }
Example #22
0
    /// <summary>
    /// 一般是切换场景的时候调用 如:OnLeaveScene
    /// </summary>
    public void UnloadAll()
    {
        var e = map.GetEnumerator();

        while (e.MoveNext())
        {
            XResources.UnloadAsset(e.Current.Value);
        }
        e.Dispose();
        map.Clear();
    }
Example #23
0
 public void UnloadEntity()
 {
     OnUnintial();
     if (_go != null)
     {
         XResources.RecyleInPool(_go, _path);
     }
     _present   = null;
     components = null;
     base.Unload();
 }
Example #24
0
        public void OnEnterScene(uint sceneid)
        {
            _time = 0;
            XLevelScriptMgr.singleton.CommandCount = 0;
            string configFile = XScene.singleton.SceneRow.SceneFile;

            if (configFile.Length == 0)
            {
                _curSpawner = null;
                XLevelScriptMgr.singleton.ClearWallInfo();
                XLevelScriptMgr.singleton.Reset();
                return;
            }

            if (_curSpawner == null)
            {
                _curSpawner = new XLevelSpawnInfo();
            }
            else
            {
                _curSpawner.Clear();
            }
            Stream s = XResources.ReadText("Table/" + configFile);
            //using (StreamReader sr = new StreamReader(s))
            StreamReader sr = new StreamReader(s);
            {
                string line      = sr.ReadLine();
                int    totalWave = int.Parse(line);
                line = sr.ReadLine();
                int PreloadWave = int.Parse(line);
                for (int i = 0; i < PreloadWave; i++)
                {
                    line = sr.ReadLine();
                    string[] info    = line.Split(',');
                    int      enemyID = int.Parse(info[0].Substring(3));
                    int      count   = int.Parse(info[1]);
                    _curSpawner.preloadInfo.Add(enemyID, count);
                }
                for (int id = 0; id < totalWave; id++)
                {
                    XLevelWave wave = new XLevelWave();
                    wave.ReadFromFile(sr);
                    _curSpawner.waves.Add(wave);

                    XLevelDynamicInfo dInfo = new XLevelDynamicInfo();
                    dInfo.id         = wave.ID;
                    dInfo.totalCount = wave.Count;
                    dInfo.Reset();
                    _curSpawner.wavesDynamicInfo.Add(wave.ID, dInfo);
                }

                XResources.ClearStream(s);
            }
        }
Example #25
0
 public GameObject GetDummy(uint statictid)
 {
     XEntityStatistics.RowData row = XTableMgr.GetTable<XEntityStatistics>().GetByID((int)statictid);
     if (row != null)
     {
         XEntityPresentation.RowData raw_data = XTableMgr.GetTable<XEntityPresentation>().GetItemID(row.PresentID);
         if (raw_data == null) return null;
         string prefab = raw_data.Prefab;
         return XResources.Load<GameObject>("Prefabs/" + prefab, AssetType.Prefab);
     }
     return null;
 }
Example #26
0
    private void MakeActor(string clip)
    {
        DisablePhysic();
        AnimatorOverrideController overrideController = new AnimatorOverrideController();
        overrideController.runtimeAnimatorController = _ator.runtimeAnimatorController;
        _ator.runtimeAnimatorController = overrideController;
        overrideController["Idle"] = XResources.Load<AnimationClip>(clip, AssetType.Anim);
        _shadow = _go.transform.Find("Shadow");
        if (_shadow != null) _shadow.GetComponent<Renderer>().enabled = true;
        _ator.cullingMode = AnimatorCullingMode.AlwaysAnimate;

    }
Example #27
0
    public void OnDied()
    {
        _state = XStateDefine.XState_Death;
        DetachAllComponents();
        XAnimComponent an = GetComponent <XAnimComponent>();

        if (an != null)
        {
            AnimationClip clip = XResources.Load <AnimationClip>(present.Death, AssetType.Anim);
            an.OverrideAnim(AnimTriger.ToDeath, clip);
        }
    }
Example #28
0
 public void CastSkill(string file)
 {
     if (_src_skill != file)
     {
         _src_skill = file;
         Stream        stream    = XResources.ReadText("Table/Skill/" + file);
         XmlSerializer formatter = new XmlSerializer(typeof(XSkillData));
         _current = (XSkillData)formatter.Deserialize(stream);
         RebuildSkillAniamtion();
     }
     Fire();
 }
Example #29
0
 public void Dispose()
 {
     path = string.Empty;
     CleanEnv();
     RebuildInspector();
     seqence?.Dispose();
     seqence = null;
     if (window != null)
     {
         window.Dispose();
     }
     XResources.Clean();
 }
Example #30
0
    static Welcome()
    {
        XConfig.Initial(LogLevel.Log, LogLevel.Error);
        XTableMgr.Initial();
        XResources.Init();

        int isShow = PlayerPrefs.GetInt("ShowWelcomeScreen", 1);

        if (isShow == 1)
        {
            EditorApplication.update += Update;
        }
    }