Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using UnityEngine;
- using spaar;
- using System.IO;
- using spaar.ModLoader;
- public class CopyPasteSettingsLoader : spaar.ModLoader.Mod{
- public CopyPasteSettingsLoader(){
- Debug.Log("Started the CopyPasteSettings mod!");
- }
- public override string Name {
- get { return "CopyPasteSettings"; }
- }
- public override string Author {
- get { return "ITR"; }
- }
- public override string DisplayName {
- get { return "CopyPasteSettings"; }
- }
- AGMwo agmWO;
- public override void OnLoad() {
- Game.DontDestroyOnLoad(agmWO = AGMwo.Instance);
- }
- public override void OnUnload() {
- }
- public override Version Version {
- get { return new Version(3,0,0); }
- }
- }
- class AGMwo : SingleInstance<AGMwo>{
- CopyPasteSettingsCoreMod agm = new CopyPasteSettingsCoreMod();
- public void Update() {
- agm.Update();
- }
- Rect windowRect = new Rect(0,75,200,45);
- Rect smallRect = new Rect(0,20,200,20);
- void OnGUI() {
- windowRect = GUI.Window(0,windowRect,DoMyWindow,"CopyPasteSettings");
- }
- void DoMyWindow(int windowID) {
- agm.G(smallRect);
- GUI.DragWindow();
- }
- public override string Name {
- get { return "CopyPasteSettings"; }
- }
- }
- public class CopyPasteSettingsCoreMod{
- GameObject gm;
- BlockInfoController blockInfoController;
- bool pasteBuild = false;
- int n = 0;
- int n2 = 0;
- bool shownError = false;
- MyBlockInfo myBlockInfo;
- public void pasteInfo() {
- for(int x = n;x<=n;x++) {
- GameObject gm = GameObject.Find("bsg"+x.ToString());
- if(gm!=null) {
- if(x==n)
- n++;
- if(!pasteBuild||myBlockInfo==null)
- continue;
- MyBlockInfo tempBlockInfo = gm.GetComponent<MyBlockInfo>();
- if(tempBlockInfo.blockName==myBlockInfo.blockName) {
- tempBlockInfo.toggleModeEnabled = myBlockInfo.toggleModeEnabled;
- tempBlockInfo.sliderValue = myBlockInfo.sliderValue;
- tempBlockInfo.key1 = myBlockInfo.key1;
- tempBlockInfo.key2 = myBlockInfo.key2;
- }
- }
- }
- for(int x = n2;x<=n2;x++) {
- GameObject gm = GameObject.Find("bgeL"+x.ToString());
- if(gm!=null) {
- if(x==n2)
- n2++;
- if(!pasteBuild||myBlockInfo==null)
- continue;
- MyBlockInfo tempBlockInfo = gm.GetComponent<MyBlockInfo>();
- if(tempBlockInfo.blockName==myBlockInfo.blockName) {
- tempBlockInfo.toggleModeEnabled = myBlockInfo.toggleModeEnabled;
- tempBlockInfo.sliderValue = myBlockInfo.sliderValue;
- tempBlockInfo.key1 = myBlockInfo.key1;
- tempBlockInfo.key2 = myBlockInfo.key2;
- }
- }
- }
- }
- public void G(Rect rect){
- if(AddPiece.isSimulating)
- return;
- GUILayout.BeginArea(rect);
- GUILayout.BeginHorizontal();
- GUILayout.FlexibleSpace();
- try {
- pasteBuild = GUILayout.Toggle(pasteBuild,"auto paste settings");
- shownError = false;
- }
- catch (Exception e) {
- if(!shownError)
- Debug.Log("CopyPaste error: "+e.ToString());
- shownError = true;
- }
- GUILayout.FlexibleSpace();
- GUILayout.EndHorizontal();
- GUILayout.EndArea();
- // GUILayout.BeginArea(new Rect(0,78,40,300));
- // GUILayout.Label("n: "+n.ToString()+" n2:"+n2.ToString());
- // if(myBlockInfo!=null)
- // GUILayout.Label(myBlockInfo.blockName);
- // GUILayout.EndArea();
- }
- public void Update(){
- if(AddPiece.isSimulating)
- return;
- if(gm==null){
- gm = GameObject.Find("BLOCK INFO CONTROLLER");
- if(gm!=null)
- Debug.Log("found \"BLOCK INFO CONTROLLER\"");
- }
- else{
- if(blockInfoController==null) {
- blockInfoController = gm.GetComponent<BlockInfoController>();
- if(blockInfoController!=null)
- Debug.Log("found \"JoinOnTriggerBlock\"");
- }
- else {
- if(blockInfoController.menuHolder.gameObject.activeSelf) {
- myBlockInfo = blockInfoController.activeBlockInfoCode;
- }
- }
- }
- pasteInfo();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement