using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Hashtable = ExitGames.Client.Photon.Hashtable;
using UnityEngine.SceneManagement;

public class CharacterSelect : MonoBehaviourPunCallbacks
{
    public bool p1;
    public bool p2;

    private void Update()
    {
        if (p1 && p2)
        {

        }
    }

    public void SelectLadybug()
    {
        Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
        hash.Add("Ladybug", PhotonNetwork.LocalPlayer.ActorNumber);
        PhotonNetwork.LocalPlayer.SetCustomProperties(hash);

        // DoBool();

        PhotonNetwork.LoadLevel("Room");

        // PhotonNetwork.AutomaticallySyncScene = false;
        // PhotonNetwork.LeaveRoom();
    }

    public override void OnLeftRoom()
    {
        SceneManager.LoadScene("Room");
    }

    public void SelectDragonfly()
    {
        Hashtable hash = PhotonNetwork.LocalPlayer.CustomProperties;
        hash.Add("Dragonfly", PhotonNetwork.LocalPlayer.ActorNumber);
        PhotonNetwork.LocalPlayer.SetCustomProperties(hash);


        PhotonNetwork.LoadLevel("Room");

        // DoBool();

        // if (PhotonNetwork.IsMasterClient)
        // {
        //     PhotonNetwork.LoadLevel("Game");
        //     PhotonNetwork.AutomaticallySyncScene = false;
        // }
        // else
        // {
        //     SceneManager.LoadScene("Game");
        // }
    }

    void DoBool()
    {
        if (PhotonNetwork.LocalPlayer.ActorNumber == 1)
        {
            p1 = true;
        }
        else
        {
            p2 = true;
        }
    }
}
