using System;
using UnityEngine;
using Wizard;

public class MatchingRetryDomatching : MatchingIntervalActionBase
{
	private int _retryPeriodSecond;

	private int _needInit;

	public Action OnDoMatchingSuccess;

	public MatchingRetryDomatching(Matching matching)
		: base(matching)
	{
	}

	public void SetNeedInit(int need_Init)
	{
		_needInit = need_Init;
	}

	public void SettingRetryPeriod(int retryPeriodSeconds)
	{
		_retryPeriodSecond = retryPeriodSeconds;
	}

	public override void Start()
	{
		base.Start();
		string text = "do_matchingRetryStart ";
		if ((bool)ToolboxGame.RealTimeNetworkAgent)
		{
			text += ToolboxGame.RealTimeNetworkAgent.CurrentMatchingStatus;
		}
		text += StackTraceUtility.ExtractStackTrace();
		LocalLog.AccumulateLastTraceLog(text);
	}

	public override void Update()
	{
		if (_isActive && NetworkUtility.GetTimeSpanSecond(_startTimer.Ticks) >= _retryPeriodSecond)
		{
			_isActive = false;
			_matching.DoMatching(OnDoMatchingSuccess, _needInit, Matching.DO_MATCHING_LOG.RETRY);
		}
	}
}
