Exemple #1
0
    // 强引导,完全可以只检测下一个教学的触发条件
    // @return -1表示无触发ID
    public static int DetectNextTeachTrigger()
    {
        int fin_teach_id = CustomPrefs.GetFinishedTeachID();

        int next_idx = -1;

        if (fin_teach_id < 0)
        {
            next_idx = 0;
        }
        else
        {
            next_idx = TeachMgr.Instance.GetNextTeachIdx(fin_teach_id);
        }

        List <int> teach_list = TeachCSV.Instance.teachIDList;

        if (next_idx >= 0 && next_idx < teach_list.Count)
        {
            int id = teach_list[next_idx];
            if (IsTrigger(id))
            {
                return(id);
            }
        }
        return(-1);
    }
Exemple #2
0
        static void Postfix(vp_FPWeapon __instance)
        {
            // I don't actually use these values because the game overrides them for non-gun items. RenderingFieldOfView is set to 45 from scripts inside resources.assets such as WeaponBow, WeaponDefault ...
            CustomPrefs customPrefs = CustomPrefs.GetCustomPrefs();

            try
            {
                __instance.RenderingFieldOfView         = customPrefs.GetCustomPref <int>("WeaponFov");
                __instance.originalRenderingFieldOfView = customPrefs.GetCustomPref <int>("WeaponFov");
            }
            catch (ArgumentException e)
            {
                customPrefs.SetCustomPref <int>("WeaponFov", 60);
                __instance.RenderingFieldOfView         = customPrefs.GetCustomPref <int>("WeaponFov");
                __instance.originalRenderingFieldOfView = customPrefs.GetCustomPref <int>("WeaponFov");
            }
        }
Exemple #3
0
        static bool Prefix(vp_FPWeapon __instance, float ___m_FinalZoomTime, bool ___m_Wielded, GameObject ___m_WeaponCamera)
        {
            if (!___m_Wielded)
            {
                return(false);
            }

            __instance.RenderingZoomDamping = Mathf.Max(__instance.RenderingZoomDamping, 0.01f);
            float num = 1f - (___m_FinalZoomTime - Time.time) / __instance.RenderingZoomDamping;

            if (___m_WeaponCamera != null)
            {
                CustomPrefs customPrefs = CustomPrefs.GetCustomPrefs();
                ___m_WeaponCamera.GetComponent <Camera>().fieldOfView = Mathf.SmoothStep(___m_WeaponCamera.gameObject.GetComponent <Camera>().fieldOfView, customPrefs.GetCustomPref <int>("WeaponFov"), num * 15f);
            }

            return(false);
        }
        private void CheckPreferences()
        {
            bool hasKey = Xamarin.Essentials.Preferences.ContainsKey("savedKeys");

            if (hasKey)
            {
                string        keysList = Xamarin.Essentials.Preferences.Get("savedKeys", "default_value");
                List <string> Keys     = keysList.Split('/').ToList();

                foreach (string key in Keys)
                {
                    string value = Xamarin.Essentials.Preferences.Get(key, "default_value");
                    CustomPrefs.Add(new CustomPref()
                    {
                        Key = key, Value = value
                    });
                }
            }
        }
Exemple #5
0
    // 检测所有未完成教学检测是否满足触发条件
    public static int DetectAllTeachTrigger()
    {
        int fin_teach_id = CustomPrefs.GetFinishedTeachID();

        if (fin_teach_id >= 0)
        {
            int idx = TeachMgr.Instance.GetNextTeachIdx(fin_teach_id);

            List <int> teach_list = TeachCSV.Instance.teachIDList;
            for (int i = idx; i < teach_list.Count; ++i)
            {
                int id = teach_list[i];
                if (IsTrigger(id))
                {
                    return(id);
                }
            }
        }
        return(-1);
    }
Exemple #6
0
    void NextTeachStep()
    {
        if (curTeachStep != null)
        {
            curTeachStep.OnOver();
        }

        teachingStepIdx += 1;
        if (teachingStepIdx >= teachStepList.Count)
        {
            // Teach finished
            isTeaching                 = false;
            isFinishedGroup            = true;
            finishedStates[teachingID] = true;

            interruptTeachID     = -1;
            interruptTeachStepID = -1;
            finishedTeachID      = teachingID;

            // Gate finished
            finishedStates[teachingID] = true;
            CustomPrefs.SetFinishedTeachID(teachingID);

            // TODO:by Teng.和服务器交互
            Debuger.LogError(string.Format("Teach {0} finished!", teachingID));

            if (IsLastTeachIdx(teachingID))
            {
                isFinishedAll = true;
            }
            else
            {
                DetectNewTeach();
            }
        }
        else
        {
            curTeachStep = CreateTeachStep(teachingStepID);
            curTeachStep.OnStart();
        }
    }
Exemple #7
0
    public void Init()
    {
        int fin_id = CustomPrefs.GetFinishedTeachID();

        if (finishedStates.Count == 0)
        {
            List <int> ls = TeachCSV.Instance.teachIDList;
            for (int i = 0; i < ls.Count; ++i)
            {
                int id = ls[i];

                if (id <= fin_id)
                {
                    finishedStates[id] = true;
                }
                else
                {
                    finishedStates[id] = false;
                }
            }
        }
    }
Exemple #8
0
    public override void Execute(List <string> _params, global::CommandSenderInfo _senderInfo)
    {
        CustomPrefs customPrefs = CustomPrefs.GetCustomPrefs();

        int num;

        if (_params.Count == 0)
        {
            try
            {
                global::SingletonMonoBehaviour <global::SdtdConsole> .Instance.Output(customPrefs.GetCustomPref <int>("WeaponFov").ToString());
            }
            catch (ArgumentException)
            {
                global::SingletonMonoBehaviour <global::SdtdConsole> .Instance.Output("WeaponFov is not set");
            }
        }
        else if (_params.Count == 1 && int.TryParse(_params[0], out num))
        {
            customPrefs.SetCustomPref <int>("WeaponFov", num);
            global::SingletonMonoBehaviour <global::SdtdConsole> .Instance.Output("Set Weapon/Hands FOV to " + num);
        }
    }