forked from lisa-lionheart/TrafficReport
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModMain.cs
More file actions
102 lines (76 loc) · 2.89 KB
/
ModMain.cs
File metadata and controls
102 lines (76 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using ICities;
using UnityEngine;
using ColossalFramework.Plugins;
using ColossalFramework;
using ColossalFramework.UI;
using System.Reflection;
using System;
namespace TrafficReport
{
public class TestMod : IUserMod
{
System.Version verison;
public TestMod()
{
//Assembly asembly = Assembly.GetAssembly(typeof(TestMod));
//this.verison = asembly.GetName().Version;
//Log.info("Mod class created " + this.verison);
}
public string Name
{
get { return "Traffic Report Tool"; }
}
public string Description
{
get { return "Display traffic information for a single vehicle, a secotion of road or a building"; }
}
}
public class LoadingExtension : LoadingExtensionBase
{
QueryTool queryTool;
UIButton button;
public override void OnLevelLoaded(LoadMode mode)
{
queryTool = GameObject.FindWithTag("GameController").AddComponent<QueryTool>();
ToolsModifierControl.SetTool<DefaultTool>();
/*
UIView uiView = UIView.GetAView();
// Add a new button to the view.
button = (UIButton)uiView.AddUIComponent(typeof(UIButton));
// Set the text to show on the button.
button.text = "Traffic Report Tool";
// Set the button dimensions.
button.width = 150;
button.height = 40;
// Style the button to look like a menu button.
button.normalBgSprite = "ButtonMenu";
button.disabledBgSprite = "ButtonMenuDisabled";
button.hoveredBgSprite = "ButtonMenuHovered";
button.focusedBgSprite = "ButtonMenuFocused";
button.pressedBgSprite = "ButtonMenuPressed";
button.textColor = new Color32(255, 255, 255, 255);
button.disabledTextColor = new Color32(7, 7, 7, 255);
button.hoveredTextColor = new Color32(7, 132, 255, 255);
button.focusedTextColor = new Color32(255, 255, 255, 255);
button.pressedTextColor = new Color32(30, 30, 44, 255);
// Place the button.
button.transformPosition = new Vector3(-1.65f, 0.97f);
button.eventClick += toggleQueryTool;
* */
}
void toggleQueryTool(UIComponent component, UIMouseEventParameter eventParam)
{
if(ToolsModifierControl.toolController.CurrentTool == queryTool) {
ToolsModifierControl.SetTool<DefaultTool>();
button.normalBgSprite = "ButtonMenu";
}
else
{
Log.info("Selecting query tool");
ToolsModifierControl.toolController.CurrentTool = queryTool;
button.normalBgSprite = "ButtonMenuPressed";
}
}
}
}