using ET.EventType;
using System.Collections.Generic;
using UnityEngine;

namespace ET
{
	[FriendOfAttribute(typeof(ET.StartFightRoomComponment))]
    [FriendOfAttribute(typeof(ET.StartFightRoomInfo))]
    public static class StartFightRoomComponentSystem
    {
		public static void ClearStartFightRoomInfo(this StartFightRoomComponment self)
		{ 
			self.startFightRoomInfo?.Dispose();
		}

        public static async ETTask SetStartFightRoomInfoFromPush(this StartFightRoomComponment self, RoomInfo roomInfo)
        {
			self.startFightRoomInfo.roomInfo = roomInfo;
            await ETTask.CompletedTask;
        }

        public static void SetOperatorOpType(this StartFightRoomComponment self,int opType)
        {
            self.startFightRoomInfo.opType = opType;
        }

        public static void SetStartFightRoomInfoFromCreate(this StartFightRoomComponment self, RoomInfo roomInfo)
        {
            self.startFightRoomInfo.roomInfo = roomInfo;
        }

        public static StartFightRoomInfo GetStartFightRoomInfo(this StartFightRoomComponment self)
		{
			return self.startFightRoomInfo;
        }

        public static async ETTask SetReadyTimeCount(this StartFightRoomComponment self,long startTimeCount)
        {
            self.startFightRoomInfo.readyStartTimeCount = startTimeCount;
            await ETTask.CompletedTask;
        }

        public static async ETTask SetSettlementFromPush(this StartFightRoomComponment self, int CurRound, List<PlayerInfo> PlayerInfo)
        {
            if (self.startFightRoomInfo.settlementInfo == null)
            {
                self.startFightRoomInfo.settlementInfo = new SettlementInfo();
            }
            self.startFightRoomInfo.settlementInfo.CurRound = CurRound;
            self.startFightRoomInfo.settlementInfo.PlayerInfo = PlayerInfo; 
            await ETTask.CompletedTask;
        }

        public static SettlementInfo GetSettlementInfo(this StartFightRoomComponment self)
        {
            return self.startFightRoomInfo.settlementInfo;
        }
    }
}