using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI; //andr
using UnityEngine.SceneManagement;
using System.IO; //
using UnityEngine.Video;//streaming
using UnityEngine.Networking;

using static UIconfig;
using static StreamingAssetLoader;


public class updateMouseCursor : MonoBehaviour
{

    public Texture2D cursorArrow_35;
    public Texture2D cursorArrow_50;
    public Texture2D cursorArrow_60;
    public Texture2D cursorArrow_70;
    public Texture2D cursorArrow_100;
    public Texture2D cursorArrow_140;
    public Texture2D cursorArrow_200;
    public Texture2D cursorArrow_300;
    /*
    public GameObject TAV_Slider;
    public GameObject TAvisibilityT;
    */

    private Color colChangeable = new Color(1f, 1f, 1f, 0.5f);
    private Color colChangeable2 = new Color(1f, 1f, 1f, 0.5f);

    //public GameObject TouchModeButton;


    //public GameObject back_GObj;

    void Start()
    {
        setMouse();
    }

    private void Update()
    {

    }


    public void setMouse()
    {

        //print("OPSYS: " + CommunicationEvents.Opsys);
        if (CommunicationEvents.Opsys == 1)
        {
            CommunicationEvents.CursorVisDefault = false;
            //Cursor.visible = false;
        }
        else
        {
            Cursor.visible = true;
            CommunicationEvents.CursorVisDefault = true;
        }

        //Android crashes in level scene;
        if (CommunicationEvents.Opsys != 1)
        {
            double curssz = 1 / (UIconfig.cursorSize);
            // print(UIconfig.cursorSize);

            if (UIconfig.screWidth / 35 < curssz)
            {
                Cursor.SetCursor(cursorArrow_35, Vector2.zero, CursorMode.ForceSoftware);
                print("m35");
            }
            else
            {
                if (UIconfig.screWidth / 50 < curssz)
                {
                    Cursor.SetCursor(cursorArrow_50, Vector2.zero, CursorMode.ForceSoftware);
                    print("m50");
                }
                else
                {

                    if (UIconfig.screWidth / 60 < curssz)
                    {
                        Cursor.SetCursor(cursorArrow_60, Vector2.zero, CursorMode.ForceSoftware);
                        print("m60");
                    }
                    else
                    {
                        if (UIconfig.screWidth / 70 < curssz)
                        {
                            Cursor.SetCursor(cursorArrow_70, Vector2.zero, CursorMode.ForceSoftware);
                            print("m70");
                        }
                        else
                        {
                            if (UIconfig.screWidth / 100 < curssz)
                            {
                                Cursor.SetCursor(cursorArrow_100, Vector2.zero, CursorMode.ForceSoftware);
                                print("m100");
                            }
                            else
                            {
                                if (UIconfig.screWidth / 140 < curssz)
                                {
                                    Cursor.SetCursor(cursorArrow_140, Vector2.zero, CursorMode.ForceSoftware);
                                    print("m140");
                                }
                                else
                                {
                                    if (UIconfig.screWidth / 200 < curssz)
                                    {
                                        Cursor.SetCursor(cursorArrow_200, Vector2.zero, CursorMode.ForceSoftware);
                                        print("m200");
                                    }
                                    else
                                    {
                                        Cursor.SetCursor(cursorArrow_300, Vector2.zero, CursorMode.ForceSoftware);
                                        print("m300");
                                    }
                                }
                            }
                        }
                    }
                }
            }


        }




    }
}