using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Touka.GameLogic;

public class ToukaStageCommonEvent : ToukaSingletonMonoBehaviour<ToukaStageCommonEvent>
{
    #region 每局游戏时长

    float stageStartedTime = 0;
    public void SetBeginStageTime()
    {
        stageStartedTime = Time.time;
    }

    public int GetStageDeltaTime()
    {
        int deltaTime = (int)Mathf.Ceil(Time.time - stageStartedTime);
        Debug.Log("获取一关的时间间隔");
        return deltaTime;
    }

    #endregion
    /// <summary>
    /// 开始本局游戏
    /// </summary>
    /// <param name="_levelId"> 关卡id </param>
    public void StageStartEvent(int _levelId)
    {
        SetBeginStageTime();
        ToukaSDKManager.Instance.LogEventByUmeng(StaticStringsEvent.Event_Sort_stage_start, StaticStringsEvent.Event_Sort_stage_level, _levelId.ToString());
    }

    /// <summary>
    /// 当局游戏时长 （从开局到结算页弹出为止）
    /// </summary>
    /// <param name="_levelId"> 关卡id </param>
    public void StageTimeEvent(int _levelId)
    {
        int lastSeconds = GetStageDeltaTime();
        ToukaSDKManager.Instance.LogEventByUmeng(StaticStringsEvent.Event_Sort_stage_time, StaticStringsEvent.Event_Sort_stage_level, _levelId.ToString(), StaticStringsEvent.Event_Sort_time_long, lastSeconds.ToString());
    }

    /// <summary>
    /// 展示本局游戏失败结算页
    /// </summary>
    /// <param name="_levelId"> 关卡id </param>
    public void StageFailureEvent(int _levelId)
    {
        ToukaSDKManager.Instance.LogEventByUmeng(StaticStringsEvent.Event_Sort_stage_failure, StaticStringsEvent.Event_Sort_stage_level, _levelId.ToString());
    }

    /// <summary>
    /// 展示本局游戏成功结算页
    /// </summary>
    /// <param name="_levelId"> 关卡id </param>
    public void StageSuccessEvent(int _levelId)
    {
        ToukaSDKManager.Instance.LogEventByUmeng(StaticStringsEvent.Event_Sort_stage_success, StaticStringsEvent.Event_Sort_stage_level, _levelId.ToString());
    }
}