Пример #1
0
    // Use this for initialization
    internal void Start()
    {
        Application.targetFrameRate = 60;
        QualitySettings.vSyncCount  = 1;
        QualitySettings.SetQualityLevel(1);
        try {
            if (!GameControler.IsInited)
            {
                Application.runInBackground = true;
                string dataPath            = Application.dataPath;
                string persistentDataPath  = Application.persistentDataPath;
                string streamingAssetsPath = Application.streamingAssetsPath;
                string tempPath            = Application.temporaryCachePath;
                LogicSystem.GfxLog("dataPath:{0} persistentDataPath:{1} streamingAssetsPath:{2} tempPath:{3}", dataPath, persistentDataPath, streamingAssetsPath, tempPath);
#if UNITY_ANDROID
                GameControler.InitGame(tempPath, streamingAssetsPath);
#elif UNITY_IPHONE
                GameControler.InitGame(tempPath, streamingAssetsPath);
#else
                GameControler.InitGame(dataPath, streamingAssetsPath);
#endif
                GlobalVariables.Instance.IsMobile = true;
                GameControler.StartGame();
                LogicSystem.SetLoadingBarScene("LoadingBar");
                //LogicSystem.PublishLogicEvent("ge_change_scene", "game", 6);
                Application.LoadLevel("Loading");
            }
        } catch (Exception ex) {
            LogicSystem.GfxLog("GameLogic.Start throw exception:{0}\n{1}", ex.Message, ex.StackTrace);
        }
    }
Пример #2
0
    // Anim
    public static bool PlayAnims(GameObject target, params SkillAnimInfo[] infos)
    {
        Animation animCom = target.GetComponent <Animation>();

        if (animCom == null)
        {
            LogicSystem.GfxLog("PlayAnim animation component miss!");
            return(false);
        }

        for (int i = 0; i < infos.Length; ++i)
        {
            SkillAnimInfo info = infos[i];
            if (info == null || info.AnimName == null || animCom[info.AnimName.name] == null)
            {
                continue;
            }
            animCom[info.AnimName.name].speed    = info.AnimSpeed;
            animCom[info.AnimName.name].wrapMode = info.AnimWrapMode;
            animCom[info.AnimName.name].layer    = info.AnimLayer;
            animCom.PlayQueued(info.AnimName.name, QueueMode.CompleteOthers);
        }

        return(true);
    }
Пример #3
0
    public static void ChangeWeapon(GameObject target, SkillWeaponInfo param)
    {
        WeaponControl control = target.GetComponent <WeaponControl>();

        if (control == null)
        {
            LogicSystem.GfxLog("ShooterSkillExecutor WeaponControl Script miss!");
        }
        control.ChangeWeapon(param);
    }
Пример #4
0
    public static void SwitchNextWeapon(GameObject target)
    {
        WeaponControl control = target.GetComponent <WeaponControl>();

        if (control == null)
        {
            LogicSystem.GfxLog("SwitchWeapon WeaponControl Script miss!");
            return;
        }
        control.SwitchNextWeapon();
    }
Пример #5
0
    public static void StartMoveScale(GameObject target, SkillMoveScaleInfo info)
    {
        MovementControl tLockFrame = target.gameObject.GetComponent <MovementControl>();

        if (tLockFrame == null)
        {
            LogicSystem.GfxLog("StartMoveScale component miss!");
            return;
        }
        tLockFrame.StartMoveScale(info);
    }
Пример #6
0
    public static void StartLockFrame(GameObject target, SkillLockFrameInfo info)
    {
        SkillLockFrame tLockFrame = target.gameObject.GetComponent <SkillLockFrame>();

        if (tLockFrame == null)
        {
            LogicSystem.GfxLog("Trigger_LockFrame component miss!");
            return;
        }
        tLockFrame.StartLockFrame(info);
    }
Пример #7
0
    public static void ChangeSkillByCategory(GameObject target, SkillCategory category, int skillId)
    {
        ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>();

        if (mgr == null)
        {
            LogicSystem.GfxLog("GetCurSkill skill manager miss!");
            return;
        }
        mgr.ChangeSkillByCategory(category, skillId);
    }
Пример #8
0
    public static SkillLockFrameInfo GetLockFrameInfoById(GameObject target, int id)
    {
        SkillSceneObjManager tSceneObjMgr = target.GetComponent <SkillSceneObjManager>();

        if (tSceneObjMgr == null)
        {
            LogicSystem.GfxLog("SkillSceneObjManager miss!");
            return(null);
        }
        return(tSceneObjMgr.TryGetSkillLockFrameInfo(id));
    }
Пример #9
0
    public static void SetFacePos(GameObject target, Vector3 targetPos, MathRange YRotateRange)
    {
        ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>();

        if (mgr == null)
        {
            LogicSystem.GfxLog("SetFacePos skill manager miss!");
            return;
        }
        mgr.SetFacePos(targetPos, YRotateRange);
    }
Пример #10
0
    internal void Start()
    {
        m_SceneObjMgr = gameObject.GetComponent <SkillSceneObjManager>();
        if (m_SceneObjMgr == null)
        {
            LogicSystem.GfxLog("ShooterSkillTrigger miss!");
            return;
        }

        TriggerImpl.OnGetSkillSoundInfo = m_SceneObjMgr.TryGetSkillSoundInfo;
    }
Пример #11
0
    public static SkillAnimInfo GetDefaultAnimInfo(GameObject target)
    {
        ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>();

        if (mgr == null)
        {
            LogicSystem.GfxLog("GetDefaultAnimInfo control miss!");
            return(null);
        }
        return(mgr.DefaultAnimInfo);
    }
Пример #12
0
    public static void HideJoyStick(GameObject target)
    {
        ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>();

        if (mgr == null)
        {
            LogicSystem.GfxLog("HideJoyStick control miss!");
            return;
        }
        mgr.HideJoyStick();
    }
Пример #13
0
    public static void StopMove(GameObject target)
    {
        MovementControl mgr = target.GetComponent <MovementControl>();

        if (mgr == null)
        {
            LogicSystem.GfxLog("StartMove movement control miss!");
            return;
        }
        mgr.StopMove();
    }
Пример #14
0
    public static void NotifyIngoreGravity(GameObject target, bool isIngore)
    {
        MovementControl mgr = target.GetComponent <MovementControl>();

        if (mgr == null)
        {
            LogicSystem.GfxLog("NotifyIngoreGravity control miss!");
            return;
        }
        mgr.NotifyIngoreGravity(isIngore);
    }
Пример #15
0
    public static int GetCurWeaponId(GameObject target, MasterWeaponType masterType = MasterWeaponType.Master)
    {
        WeaponControl control = target.GetComponent <WeaponControl>();

        if (control == null)
        {
            LogicSystem.GfxLog("ShooterSkillExecutor GetCurWeaponId Script miss!");
            return(-1);
        }
        return(control.GetCurWeaponId(masterType));
    }
Пример #16
0
    public static GameObject GetCurTarget(GameObject target)
    {
        SkillTargetControl control = target.GetComponent <SkillTargetControl>();

        if (control == null)
        {
            LogicSystem.GfxLog("GetCurTarget control miss!");
            return(null);
        }
        return(control.GetCurTarget());
    }
Пример #17
0
    public static void ResetTarget(GameObject target)
    {
        SkillTargetControl control = target.GetComponent <SkillTargetControl>();

        if (control == null)
        {
            LogicSystem.GfxLog("ResetTarget control miss!");
            return;
        }
        control.ResetTarget();
    }
Пример #18
0
    public static IShooterSkill GetCurSkill(GameObject target)
    {
        ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>();

        if (mgr == null)
        {
            LogicSystem.GfxLog("GetCurSkill skill manager miss!");
            return(null);
        }
        return(mgr.GetCurPlaySkill());
    }
Пример #19
0
    public static GameObject GetWeaponByHand(GameObject target, WeaponHand hand)
    {
        WeaponControl control = target.GetComponent <WeaponControl>();

        if (control == null)
        {
            LogicSystem.GfxLog("ShooterSkillExecutor WeaponControl Script miss!");
            return(null);
        }
        return(control.GetWeaponByHand(hand));
    }
Пример #20
0
    public static bool IsAnimPlaying(GameObject target, SkillAnimInfo info)
    {
        Animation animCom = target.GetComponent <Animation>();

        if (animCom == null || info == null || info.AnimName == null || animCom[info.AnimName.name] == null)
        {
            LogicSystem.GfxLog("IsAnimPlaying animation component miss!");
            return(false);
        }
        return(animCom.IsPlaying(info.AnimName.name) && animCom[info.AnimName.name].normalizedTime < 1.0f);
    }
Пример #21
0
    public static bool StopAllAnim(GameObject target)
    {
        Animation animCom = target.GetComponent <Animation>();

        if (animCom == null)
        {
            LogicSystem.GfxLog("PlayAnim animation component miss!");
            return(false);
        }
        animCom.Stop();
        return(true);
    }
Пример #22
0
    public static bool GetCurTargetPos(GameObject target, out Vector3 targetPos)
    {
        targetPos = Vector3.zero;
        SkillTargetControl control = target.GetComponent <SkillTargetControl>();

        if (control == null)
        {
            LogicSystem.GfxLog("GetCurTargetPos control miss!");
            return(false);
        }
        return(control.GetCurTargetPos(out targetPos));
    }
Пример #23
0
    public static bool FadeOutAnim(GameObject target, SkillAnimInfo info)
    {
        Animation animCom = target.GetComponent <Animation>();

        if (animCom == null || info == null || info.AnimName == null || animCom[info.AnimName.name] == null)
        {
            LogicSystem.GfxLog("PlayAnim animation component miss!");
            return(false);
        }
        animCom[info.AnimName.name].weight = 0.0f;
        return(true);
    }
Пример #24
0
    public static float GetAnimTime(GameObject target, SkillAnimInfo info, float tweak = 0.0f)
    {
        Animation animCom = target.GetComponent <Animation>();

        if (animCom == null || info == null || info.AnimName == null || animCom[info.AnimName.name] == null)
        {
            LogicSystem.GfxLog("GetAnimTime animation component miss!");
            return(0);
        }
        float speed = Mathf.Max(info.AnimSpeed, 0.001f);

        return(animCom[info.AnimName.name].length / speed - tweak);
    }
Пример #25
0
    public static void RecordTarget(GameObject target, GameObject target2)
    {
        SkillTargetControl control = target.GetComponent <SkillTargetControl>();

        if (control == null)
        {
            LogicSystem.GfxLog("RecordTarget control miss!");
            return;
        }

        if (TriggerImpl.GetCharacterCamp(target2) != 0)
        {
            control.RecordTarget(target2);
        }
    }
Пример #26
0
    //////////////////////////////////////////////////////////////////////////
    // Anim
    public static bool PlayAnim(GameObject target, SkillAnimInfo info)
    {
        Animation animCom = target.GetComponent <Animation>();

        if (animCom == null || info == null || info.AnimName == null || animCom[info.AnimName.name] == null)
        {
            LogicSystem.GfxLog("PlayAnim animation component miss!");
            return(false);
        }
        animCom[info.AnimName.name].speed    = info.AnimSpeed;
        animCom[info.AnimName.name].wrapMode = info.AnimWrapMode;
        animCom[info.AnimName.name].layer    = info.AnimLayer;
        animCom.CrossFade(info.AnimName.name, info.AnimCrossFadeTime);
        return(true);
    }
Пример #27
0
    public static void StartMoveById(GameObject target, int id)
    {
        SkillSceneObjManager m_SceneObjMgr = target.GetComponent <SkillSceneObjManager>();

        if (m_SceneObjMgr == null)
        {
            LogicSystem.GfxLog("StartMoveById miss!");
            return;
        }
        SkillMovementInfo moveInfo = m_SceneObjMgr.TryGetSkillMovementInfo(id);

        if (moveInfo != null)
        {
            StartMove(target, moveInfo);
        }
    }
Пример #28
0
    public static void ForceStartSkillById(GameObject target, SkillCategory category, Vector3 targetpos)
    {
        ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>();

        if (mgr == null)
        {
            LogicSystem.GfxLog("GetCurSkill skill manager miss!");
            return;
        }
        ShooterControlHandler control = (ShooterControlHandler)(mgr.GetSkillController());

        if (control != null)
        {
            control.ForceStartSkillById(category, targetpos);
        }
    }
Пример #29
0
    public static GameObject CreateGameObjectByAsset(GameObject asset)
    {
        if (asset == null)
        {
            LogicSystem.GfxLog("CreateGameObjectByAsset load resource failed:{0}", asset.name);
            return(null);
        }
        GameObject effect = GameObject.Instantiate(asset) as GameObject;

        if (effect == null)
        {
            LogicSystem.GfxLog("CreateGameObjectByName Instantiate resource failed:{0}", asset.name);
            return(null);
        }
        return(effect);
    }
Пример #30
0
    public static GameObject CreateGameObjectByName(string name)
    {
        UnityEngine.Object effect_prefab = Resources.Load(name);
        if (effect_prefab == null)
        {
            LogicSystem.GfxLog("CreateGameObjectByName load resource failed:{0}", name);
            return(null);
        }
        GameObject effect = GameObject.Instantiate(effect_prefab) as GameObject;

        if (effect == null)
        {
            LogicSystem.GfxLog("CreateGameObjectByName Instantiate resource failed:{0}", name);
            return(null);
        }
        return(effect);
    }