using System;
using NCMS;
using NCMS.Utils;
using UnityEngine;
using ReflectionUtility;

namespace AncientWar
{
    class TabButtons
    {
        private static bool lined = false;
        public static void init(){
        var line = CanvasMain.instance.canvas_ui.transform.Find("CanvasBottom/BottomElements/BottomElementsMover/CanvasScrollView/Scroll View/Viewport/Content/buttons/Tab_Main/LINE");
        var newLine0 = GameObject.Instantiate(line, AncientWarTab.additionalPowersTab.transform);


           var spendaddten = NCMS.Utils.PowerButtons.CreateButton("+10", Resources.Load<Sprite>("ui/Icons/iconClock+10"),
                "增加十倍速", "呼~", new Vector2(128, 18), ButtonType.Click,  AncientWarTab.additionalPowersTab.transform, addTimeScale);
            var spendcutone = NCMS.Utils.PowerButtons.CreateButton("-1", Resources.Load<Sprite>("ui/Icons/iconClock-1"),
                "减少1倍数", "强迫症福音", new Vector2(128, -18), ButtonType.Click,  AncientWarTab.additionalPowersTab.transform, minusTimeScale);

            
        
            newLine0.transform.localPosition = new Vector2(80f, newLine0.transform.localPosition.y);
            lined = true;
            var newLine1 = GameObject.Instantiate(line, AncientWarTab.additionalPowersTab.transform);
	    }
        public static void addTimeScale()
        {
            Config.timeScale += 10;
            WorldTip.showNow("当前时间流速为" + Config.timeScale + "倍", false, "top");
        }
        public static void minusTimeScale()
        {
            if (Config.timeScale > 0)
            {
                Config.timeScale -= 1;
                WorldTip.showNow("当前时间流速为" + Config.timeScale + "倍", false, "top");
            }
        }
    }
}