diff --git a/MainMenu.js b/MainMenu.js index 6746d28..a6c6900 100644 --- a/MainMenu.js +++ b/MainMenu.js @@ -1,28 +1,6 @@ -//!ref: Scripts/Background.ui -//!ref: Scripts/MainMenu.ui -//!ref: Scripts/Prop.ui -//!ref: Scripts/Scene.ui -//!ref: Props/Sun.txml -//!ref: Props/sun.mesh -//!ref: Props/PalmTrees.txml -//!ref: Props/Moon.txml -//!ref: Props/Volcano.txml -//!ref: Props/Walrus.txml -//!ref: Props/Beach.txml -//!ref: Props/DaySky.txml -//!ref: Props/Winter.txml -//!ref: Props/Meadow.txml -//!ref: Props/City.txml -//!ref: Props/Forest.txml -//!ref: Props/Mountains.txml -//!ref: Props/Rocket.txml -//!ref: Props/Buttefly.txml -//!ref: Props/SandToys.txml -//!ref: Props/Room&Window.txml -//!ref: Props/Clouds.txml -//!ref: Props/Sunset.txml -//!ref: Props/NightSky.txml +engine.IncludeFile("local://RefFiles.js"); +engine.IncludeFile("local://MumbleFunc.js"); engine.ImportExtension("qt.core"); engine.ImportExtension("qt.gui"); @@ -36,17 +14,65 @@ engine.ImportExtension("qt.gui"); */ var SceneList_visible = false; -var PropList_visible = false; var BackgroundList_visible = false; +var PropType_visible = false; + +var ElementList_visible = false; +var ObjectList_visible = false; +var EffectList_visible = false; +var ManMadeList_visible = false; + +var MumbleClientProxy_visible = false; +var MumbleConnectProxy_visible = false; + var CurrentClickedItemName = null; -var PropProxy = null; +var PropTypeProxy = null; var SceneProxy = null; var BackgroundProxy = null; +var ElementProxy = null; +var ObjectProxy = null; +var ManMadeProxy = null; +var EffectProxy = null; + +var MumbleProxy = null; +var MumbleClientProxy = null; +var MumbleConnectProxy = null; var _SceneListWidget = null; -var _PropListWidget = null; var _BackgroundListWidget = null; +var _ElementListWidget = null; +var _ObjectListWidget = null; +var _ManMadeListWidget = null; +var _EffectListWidget = null; + + +var _mumbleClientWidget = null; +var _mumbleConnectWidget = null; + +var _buttonConnect = null; +var _buttonDisconnect = null; +var _buttonWizard = null; +var _buttonSelfMute = null; +var _buttonSelfDeaf = null; +var _userList = null; + +//------------mumble /variable----begin-------------// +var _connectionInfo = +{ + host : "athena.mumble-serveur.com", // Change to IP if you want to test remote Murmur servers. + port : 13501, // Default port for Murmur, see murmur.ini for changing this. + password : "e92ds6gs", // Default password for Murmur is empty, see murmur.ini for changing this. + channel : "mumble-serveur.com public #1", // Default Murmur server will have one channel called "Root". Empty channel name is depicted as "Root" when connecting via MumblePlugin. + outputMuted : false, // True means your voice is sent after connecting, false means your output is muted. + intputMuted : false // True means voice should be sent to us from other client after connecting, false means server wont send us the voice packets. +}; + + + +//------------mumble /variable ----- end ------------// + + /* Use these to get added properties into right positions. Divided into 3 groups. */ @@ -58,7 +84,7 @@ var Objects = ["PalmTrees", "Butterflies", "Mushroom", "Tree1", "Tree2", "Rocks" var ManMade = ["Mob", "SnowMan", "SandCastle", "Rocket", "Parasol", "SandToys", "Tombstone", "Pirates", "Car", "Treasure"]; var SpecialEffects = ["Fire", "Smoke", "FireWorks", "PinkElephant", "BlackMonolith", "UFO", "Hearts"]; - +var PropType = ["Element","Object","ManMade","Effect"]; var ScenePos = [ @@ -87,84 +113,301 @@ this.Positions = [ScenePos, GroundPropPos, SkyPropPos, BackgPos]; function Init() { +// ---------------------------- Hook to MumblePlugin / start ---------------------------------// + + mumble.Connected.connect(OnConnected); + mumble.Disconnected.connect(OnDisconnected); + mumble.ConnectionRejected.connect(OnRejected); + + mumble.MeCreated.connect(OnMeCreated); + mumble.JoinedChannel.connect(OnJoinedChannel); + + mumble.UserMuted.connect(OnUserLocalMuteChanged); + mumble.UserSelfMuted.connect(OnUserSelfMutedChange); + mumble.UserSelfDeaf.connect(OnUserSelfDeafChange); + mumble.UserSpeaking.connect(OnUserSpeakingChange); + mumble.UserPositionalChanged.connect(OnUserPositionalChange); + mumble.ChannelTextMessageReceived.connect(OnChannelTextMessageReceived); + +// ---------------------------- Hook to MumblePlugin / end ---------------------------------// + + + // load the file "MainMenu.ui" - var _widget = ui.LoadFromFile("Scripts/MainMenu.ui", false); + var _widget = ui.LoadFromFile("Scripts/MainMenu.ui",false); var _PropBtn = findChild(_widget, "PropBtn"); _PropBtn.pressed.connect(PropBtnClicked); // listening to the singal of prop button clicked - + var _SceneBtn = findChild(_widget, "SceneBtn"); _SceneBtn.pressed.connect(SceneBtnClicked); // listening to the singal of SceneBtn button clicked - + var _BackgroundBtn = findChild(_widget, "BackgroundBtn"); _BackgroundBtn.pressed.connect(BackgroundBtnClicked); // listening to the singal of background button clicked - + var _ClearMenuBtn = findChild(_widget, "ClearMenuBtn"); _ClearMenuBtn.pressed.connect(ClearMenuBtnClicked); // listering to the singal of clean menu button clicked - + var _ClearEntityBtn = findChild(_widget,"ClearEntityBtn"); _ClearEntityBtn.pressed.connect(RemoveAllEntities); // listering to the singal of clean entity button clicked - - //Add connects to elements, man made, special effectts and object buttons. + var _RandomBtn = findChild(_widget,"RandomBtn"); + _RandomBtn.pressed.connect(RandomButtonClicked); + + var _MumbleBtn = findChild(_widget,"MumbleBtn") + _MumbleBtn.pressed.connect(MumbleBtnClicked); + //Add connects to elements, man made, special effectts and object buttons. + var MenuProxy = new UiProxyWidget(_widget); ui.AddProxyWidgetToScene(MenuProxy); MenuProxy.visible = true; MenuProxy.windowFlags = 0; - + MenuProxy.x = 860; MenuProxy.y = 25; - + + // load the file "Scene.ui" var _SceneWidget = ui.LoadFromFile("Scripts/Scene.ui", false); - + _SceneListWidget = findChild(_SceneWidget, "SceneListWidget"); _SceneListWidget.itemDoubleClicked.connect(SceneListItemDoubleClicked); - + SceneProxy = new UiProxyWidget(_SceneWidget); ui.AddProxyWidgetToScene(SceneProxy); SceneProxy.visible = SceneList_visible; // set the SceneList_visibe = false; SceneProxy.windowFlags = 0; - SceneProxy.x = 965; // they should be caculated late + SceneProxy.x = 965; SceneProxy.y = 25; - -// load the file "Prop.ui" - var _PropWidget = ui.LoadFromFile("Scripts/Prop.ui", false); - - _PropListWidget = findChild(_PropWidget,"PropListWidget"); - _PropListWidget.itemDoubleClicked.connect(PropListItemDoubleClicked); // listen to the event of item double clicked in PropListWidget - - PropProxy = new UiProxyWidget(_PropWidget); - - ui.AddProxyWidgetToScene(PropProxy); - PropProxy.visible = PropList_visible; - PropProxy.windowFlags = 0; - - PropProxy.x = 965; // they should be caculated late - PropProxy.y = 25; - // load the file "Background.ui" var _BackgroundWidget = ui.LoadFromFile("Scripts/Background.ui", false); - + _BackgroundListWidget = findChild(_BackgroundWidget,"BackgroundListWidget"); _BackgroundListWidget.itemDoubleClicked.connect(BackgroundListItemDoubleClicked); // listen to the event of item double clicked in BackgroundListWidget - + BackgroundProxy = new UiProxyWidget(_BackgroundWidget); - + ui.AddProxyWidgetToScene(BackgroundProxy); BackgroundProxy.visible = BackgroundList_visible; BackgroundProxy.windowFlags = 0; - BackgroundProxy.x = 965; // they should be caculated late + BackgroundProxy.x = 965; BackgroundProxy.y = 25; + + + +// load the file "PropType.ui" + var _PropTypeWidget = ui.LoadFromFile("Scripts/PropType.ui", false); + + _ElementBtn = findChild(_PropTypeWidget,"ElementBtn"); + _ElementBtn.pressed.connect(ElementBtnClicked); // listen to the event of Element button clicked in PropTypeWidget + + _ObjectBtn = findChild(_PropTypeWidget,"ObjectBtn"); + _ObjectBtn.pressed.connect(ObjectBtnClicked); // listen to the event of Object button clicked in PropTypeWidget + + _ManMadeBtn = findChild(_PropTypeWidget,"ManMadeBtn"); + _ManMadeBtn.pressed.connect(ManMadeBtnClicked); // listen to the event of ManMade button clicked in PropTypeWidget + + _EffectBtn = findChild(_PropTypeWidget,"EffectBtn"); + _EffectBtn.pressed.connect(EffectBtnClicked); // listen to the event of Effect button clicked in PropTypeWidget + + + PropTypeProxy = new UiProxyWidget(_PropTypeWidget); + + ui.AddProxyWidgetToScene(PropTypeProxy); + PropTypeProxy.visible = PropType_visible; + PropTypeProxy.windowFlags = 0; + + PropTypeProxy.x = 965; + PropTypeProxy.y = 25; + + +// load the file "Element.ui" + var _ElementWidget = ui.LoadFromFile("Scripts/Element.ui", false); + + _ElementListWidget = findChild(_ElementWidget,"ElementListWidget"); + _ElementListWidget.itemDoubleClicked.connect(ElementListItemDoubleClicked); // listen to the event of item double clicked in ElementListWidget + + ElementProxy = new UiProxyWidget(_ElementWidget); + + ui.AddProxyWidgetToScene(ElementProxy); + ElementProxy.visible = ElementList_visible; + ElementProxy.windowFlags = 0; + + ElementProxy.x = 965 + 105; + ElementProxy.y = 25 + 13; + +// load the file "Object.ui" + var _ObjectWidget = ui.LoadFromFile("Scripts/Object.ui", false); + + _ObjectListWidget = findChild(_ObjectWidget,"ObjectListWidget"); + _ObjectListWidget.itemDoubleClicked.connect(ObjectListItemDoubleClicked); // listen to the event of item double clicked in ObjectListWidget + + ObjectProxy = new UiProxyWidget(_ObjectWidget); + + ui.AddProxyWidgetToScene(ObjectProxy); + ObjectProxy.visible = ObjectList_visible; + ObjectProxy.windowFlags = 0; + + ObjectProxy.x = 965 + 105; + ObjectProxy.y = 25 + 13 ; + +// load the file "ManMade.ui" + var _ManMadeWidget = ui.LoadFromFile("Scripts/ManMade.ui", false); + + _ManMadeListWidget = findChild(_ManMadeWidget,"ManMadeListWidget"); + _ManMadeListWidget.itemDoubleClicked.connect(ManMadeListItemDoubleClicked); // listen to the event of item double clicked in ManMadeListWidget + + ManMadeProxy = new UiProxyWidget(_ManMadeWidget); + + ui.AddProxyWidgetToScene(ManMadeProxy); + ManMadeProxy.visible = ManMadeList_visible; + ManMadeProxy.windowFlags = 0; + + ManMadeProxy.x = 965 + 105; + ManMadeProxy.y = 25 + 13 ; + +// load the file "Effect.ui" + var _EffectWidget = ui.LoadFromFile("Scripts/Effect.ui", false); + + _EffectListWidget = findChild(_EffectWidget,"EffectListWidget"); + _EffectListWidget.itemDoubleClicked.connect(EffectListItemDoubleClicked); // listen to the event of item double clicked in EffectListWidget + + EffectProxy = new UiProxyWidget(_EffectWidget); + + ui.AddProxyWidgetToScene(EffectProxy); + EffectProxy.visible = EffectList_visible; + EffectProxy.windowFlags = 0; + + EffectProxy.x = 965 + 105; + EffectProxy.y = 25 + 13 ; + + +// --------------------------------------------------- mumble /widget---- --- begin ------------------------------------------// +// load the file "StartMumble.ui and add it into the scene" + var _mumbleWidget = ui.LoadFromFile("Scripts/StartMumble.ui",false); + var _MumbleBtn = findChild(_mumbleWidget,"MumbleBtn"); +// when the mumble button clicked, the mumble client GUI will be shown in the scene + _MumbleBtn.pressed.connect(MumbleBtnClicked); + + var MumbleProxy = new UiProxyWidget(_mumbleWidget); + ui.AddProxyWidgetToScene(MumbleProxy); +// set the default value of visible as true; + MumbleProxy.visible = true; + MumbleProxy.windowFlags = 0; + MumbleProxy.x = 1; + MumbleProxy.y = 0; + + + + _mumbleClientWidget = ui.LoadFromFile("Scripts/MumbleClientWidget.ui",false); + MumbleClientProxy = new UiProxyWidget(_mumbleClientWidget); + + _buttonConnect = findChild(_mumbleClientWidget,"buttonOpenConnect"); + _buttonConnect.clicked.connect(ShowConnectDialog); + + _buttonDisconnect = findChild(_mumbleClientWidget, "buttonDisconnect"); + _buttonDisconnect.clicked.connect(mumble, mumble.Disconnect); // Direct connection to MumblePlugin C++ QObject + + _buttonWizard = findChild(_mumbleClientWidget, "buttonOpenWizard"); + _buttonWizard.clicked.connect(mumble, mumble.RunAudioWizard); // Direct connection to MumblePlugin C++ QObject + + _buttonSelfMute = findChild(_mumbleClientWidget, "muteSelfToggle"); + _buttonSelfMute.clicked.connect(OnSelfMuteToggle); + + _buttonSelfDeaf = findChild(_mumbleClientWidget, "deafSelfToggle"); + _buttonSelfDeaf.clicked.connect(OnSelfDeafToggle); + + _userList = findChild(_mumbleClientWidget, "listUsers"); + + ui.AddProxyWidgetToScene(MumbleClientProxy); + MumbleClientProxy.visible = MumbleClientProxy_visible; + MumbleClientProxy.windowFlags = 0; + MumbleClientProxy.x = 2; + MumbleClientProxy.y = 42; + + + +//------------------------------------------------- mumble /widget-------------end ------------------------------// } + + + + + // when scene button and background button are clicked, then it should hide all sub menus of proptype + /* function clearPropTypeMenu(){ + for(var i= 0; i' + " as "+ username); + } + + function OnDisconnected(reason) + { + if (reason != "") + SetConnectionState(false, "Disconnected: " + reason); + else + SetConnectionState(false, "Disconnected"); + } + + function OnMeCreated(mumbleMe) + { + // Can hook to own user ptr signals here. + // Depends if you want to use own functions for processing 'me' signals. + // Or a generic function to handle all like this example script shows. + // You can use the signaling model you feel is best for you. + } + + function OnJoinedChannel(mumbleChannel) + { + SetChannelName(mumbleChannel.fullName); + + mumbleChannel.UserJoined.connect(OnUserJoinedPresentChannel); + mumbleChannel.UserLeft.connect(OnUserLeftPresentChannel); + } + + function GetUser(userId) + { + var user = null; + for(var i=0; i<_userList.count; ++i) + { + var item = _userList.item(i); + if (item != null && item.data(Qt.UserRole) == userId) + { + user = { listItem: item, row: i }; + break; + } + } + return user; + } + + function OnUserJoinedPresentChannel(user) + { + var listItem = new QListWidgetItem(_iconInactive, user.name + " (" + user.id.toString() + ")"); + listItem.setData(Qt.UserRole, user.id); + + if (user.isMe) + { + var font = listItem.font(); + font.setBold(true); + listItem.setFont(font); + } + + _userList.addItem(listItem); + } + + function OnUserLeftPresentChannel(userId) + { + var listItem = GetUser(userId); + if (listItem != null) + _userList.takeAt(listItem.row); + } + + function OnUserSelected(listItem) + { + if (listItem == null) + listItem = _userList.currentItem(); + if (listItem != null && listItem.data(Qt.UserRole) != null) + { + var mumbleUser = mumble.User(listItem.data(Qt.UserRole)); + if (mumbleUser.isMe) + { + _buttonMuteSelected.enabled = false; + _buttonMuteSelected.text = ""; + } + else + { + _buttonMuteSelected.enabled = true; + _buttonMuteSelected.text = mumbleUser.isMuted ? "Unmute " + mumbleUser.name : "Mute " + mumbleUser.name; + } + } + } + + function OnSelfMuteToggle() + { + var mumbleMe = mumble.Me(); + if (mumbleMe != null) + mumble.SetOutputAudioMuted(!mumbleMe.isSelfMuted); + } + + function OnSelfDeafToggle() + { + var mumbleMe = mumble.Me(); + if (mumbleMe != null) + mumble.SetInputAudioMuted(!mumbleMe.isSelfDeaf); + } + + function OnMuteSelectedToggle() + { + var currentItem = _userList.currentItem(); + if (currentItem != null && currentItem.data(Qt.UserRole) != null) + { + var user = mumble.User(currentItem.data(Qt.UserRole)); + if (user != null && !user.isMe) + user.isMuted = !user.isMuted; + } + } + + function UpdateUserState(mumbleUser) + { + var iter = GetUser(mumbleUser.id); + if (iter != null) + { + var text = mumbleUser.name + " (" + mumbleUser.id.toString() + ")"; + var props = []; + if (mumbleUser.isMuted) + props.push("muted"); + if (mumbleUser.isSelfMuted) + props.push("self muted"); + if (mumbleUser.isSelfDeaf) + props.push("deaf"); + if (!mumbleUser.isPositional) + props.push("non-positional"); + if (props.length > 0) + text += " [" + props.join(", ") + "]"; + iter.listItem.setText(text); + + //OnUserSelected(iter.listItem); + } + } + + function OnUserLocalMuteChanged(mumbleUser, isMuted) + { + UpdateUserState(mumbleUser); + } + + function OnUserSelfMutedChange(mumbleUser, isMuted) + { + UpdateUserState(mumbleUser); + if (mumbleUser.isMe) + _buttonSelfMute.text = mumbleUser.isSelfMuted ? "Unmute Self" : "Mute self"; + } + + function OnUserSelfDeafChange(mumbleUser, isDeaf) + { + UpdateUserState(mumbleUser); + if (mumbleUser.isMe) + _buttonSelfDeaf.text = mumbleUser.isSelfDeaf ? "Unmute Everyone" : "Mute Everyone"; + } + + function OnUserPositionalChange(mumbleUser, isPositional) + { + UpdateUserState(mumbleUser); + } + + function OnUserSpeakingChange(mumbleUser, speaking) + { + var iter = GetUser(mumbleUser.id); + if (iter != null) + iter.listItem.setIcon(speaking ? _iconActive : _iconInactive); + } + + function SendTextMessage() + { + var message = _chatLine.text; + if (message != "") + { + // Own messages are of course not relayed back to us, add by hand. + OnChannelTextMessageReceived(mumble.Me(), message); + // Send message to current channel. + mumble.SendTextMessage(message); + _chatLine.text = ""; + } + } + + function OnChannelTextMessageReceived(mumbleUser, message) + { + if (message != "") + _chatLog.appendHtml("[" + mumbleUser.name + "] " + message); + } + + // Bootstrap and utility functions + + + function LogInfo(msg) { console.LogInfo("[MumbleApplication]: " + msg); } + function LogError(msg) { console.LogError("[MumbleApplication]: " + msg); } \ No newline at end of file diff --git a/Scripts/Background.ui b/Scripts/Background.ui new file mode 100644 index 0000000..c591b2c --- /dev/null +++ b/Scripts/Background.ui @@ -0,0 +1,67 @@ + + + Background + + + + 0 + 0 + 110 + 200 + + + + Form + + + QWidget#Background { background-color: transparent; } +QFrame#frame { background-color: rgba(33, 217, 229, 150); + border-radius: 12px;} + + + + + + -1 + 0 + 111 + 201 + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 11 + 28 + 91 + 161 + + + + + + + 10 + 10 + 71 + 16 + + + + <html><head/><body><p><span style=" color:#ffffff;">BACKGROUND:</span></p></body></html> + + + + + + + diff --git a/Scripts/Effect.ui b/Scripts/Effect.ui new file mode 100644 index 0000000..e09ab39 --- /dev/null +++ b/Scripts/Effect.ui @@ -0,0 +1,69 @@ + + + Effect + + + + 0 + 0 + 132 + 209 + + + + true + + + Form + + + QWidget#Effect{ background-color: transparent;} +QFrame#frame { background-color: rgba(237,29,63,150); + border-radius: 12px;} + + + + + 1 + -2 + 131 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 12 + 2 + 81 + 20 + + + + <html><head/><body><p><span style=" color:#ffffff;">SPECIAL_FX:</span></p></body></html> + + + + + + 15 + 21 + 101 + 181 + + + + true + + + + + + + diff --git a/Scripts/Element.ui b/Scripts/Element.ui new file mode 100644 index 0000000..3a8da6a --- /dev/null +++ b/Scripts/Element.ui @@ -0,0 +1,68 @@ + + + Element + + + + 0 + 0 + 132 + 209 + + + + true + + + Form + + + QWidget#Element{ background-color: transparent;} +QFrame#frame{ background-color: rgba(21,122,69,150); border-radius: 15px; } + + + + + 1 + -2 + 131 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 12 + 2 + 111 + 20 + + + + <html><head/><body><p><span style=" color:#ffffff;">NATURAL_ELEMENTS:</span></p></body></html> + + + + + + 15 + 21 + 101 + 181 + + + + true + + + + + + + diff --git a/Scripts/MainMenu.js.bak b/Scripts/MainMenu.js.bak new file mode 100644 index 0000000..2ce173f --- /dev/null +++ b/Scripts/MainMenu.js.bak @@ -0,0 +1,294 @@ +//!ref: local:\\Scripts\Background.ui +//!ref: local:\\Scripts\MainMenu.ui +//!ref: local:\\Scripts\Prop.ui +//!ref: local:\\Scripts\Scene.ui + +//!ref: local:\\Props\Sun.txml +//!ref: local:\\Props\PalmTrees.txml +//!ref: local:\\Props\Beach.txml +//!ref: local:\\Props\DaySky.txml + + +engine.ImportExtension("qt.core"); +engine.ImportExtension("qt.gui"); +//engine.ImportExtension("qt.uitools"); + +/* + * MainMenu includes the submenus(background, prop, scene, clearMenu, clearEntity) + * When you click the buttons ( background, prop, scene) on the interface of MainMenu, it will popup the corresponding submenu at right side of MainMenu + * when you click the button (clearMenu) on the interface of MainMenu, it will hind the submenu in the screen + * when you click the button (clearEntity) on the interface of MainMenu, it will clear all the entities in the scene. + */ + +var SceneList_visible = false; +var PropList_visible = false; +var BackgroundList_visible = false; +var CurrentClickedItemName = null; + +var PropProxy = null; +var SceneProxy = null; +var BackgroundProxy = null; + +var _SceneListWidget = null; +var _PropListWidget = null; +var _BackgroundListWidget = null; + + +function Init() +{ +// load the file "MainMenu.ui" + var _widget = ui.LoadFromFile("Scripts/MainMenu.ui", false); + + var _PropBtn = findChild(_widget, "PropBtn"); + _PropBtn.pressed.connect(PropBtnClicked); // listening to the singal of prop button clicked + + var _SceneBtn = findChild(_widget, "SceneBtn"); + _SceneBtn.pressed.connect(SceneBtnClicked); // listening to the singal of SceneBtn button clicked + + var _BackgroundBtn = findChild(_widget, "BackgroundBtn"); + _BackgroundBtn.pressed.connect(BackgroundBtnClicked); // listening to the singal of background button clicked + + var _ClearMenuBtn = findChild(_widget, "ClearMenuBtn"); + _ClearMenuBtn.pressed.connect(ClearMenuBtnClicked); // listering to the singal of clean menu button clicked + + var _ClearEntityBtn = findChild(_widget,"ClearEntityBtn"); + _ClearEntityBtn.pressed.connect(RemoveAllEntities); // listering to the singal of clean entity button clicked + + var MenuProxy = new UiProxyWidget(_widget); + + ui.AddProxyWidgetToScene(MenuProxy); + MenuProxy.visible = true; + MenuProxy.windowFlags = 0; + + MenuProxy.x = 860; + MenuProxy.y = 25; + +// load the file "Scene.ui" + var _SceneWidget = ui.LoadFromFile("Scripts/Scene.ui", false); + + _SceneListWidget = findChild(_SceneWidget, "SceneListWidget"); + _SceneListWidget.itemDoubleClicked.connect(SceneListItemDoubleClicked); + + SceneProxy = new UiProxyWidget(_SceneWidget); + + ui.AddProxyWidgetToScene(SceneProxy); + SceneProxy.visible = SceneList_visible; // set the SceneList_visibe = false; + SceneProxy.windowFlags = 0; + + SceneProxy.x = 965; // they should be caculated late + SceneProxy.y = 25; + + +// load the file "Prop.ui" + var _PropWidget = ui.LoadFromFile("Scripts/Prop.ui", false); + + _PropListWidget = findChild(_PropWidget,"PropListWidget"); + _PropListWidget.itemDoubleClicked.connect(PropListItemDoubleClicked); // listen to the event of item double clicked in PropListWidget + + PropProxy = new UiProxyWidget(_PropWidget); + + ui.AddProxyWidgetToScene(PropProxy); + PropProxy.visible = PropList_visible; + PropProxy.windowFlags = 0; + + PropProxy.x = 965; // they should be caculated late + PropProxy.y = 25; + +// load the file "Background.ui" + var _BackgroundWidget = ui.LoadFromFile("Scripts/Background.ui", false); + + _BackgroundListWidget = findChild(_BackgroundWidget,"BackgroundListWidget"); + _BackgroundListWidget.itemDoubleClicked.connect(BackgroundListItemDoubleClicked); // listen to the event of item double clicked in BackgroundListWidget + + BackgroundProxy = new UiProxyWidget(_BackgroundWidget); + + ui.AddProxyWidgetToScene(BackgroundProxy); + BackgroundProxy.visible = BackgroundList_visible; + BackgroundProxy.windowFlags = 0; + + BackgroundProxy.x = 965; // they should be caculated late + BackgroundProxy.y = 25; + + +} + +/* + * handle the mouse event occur on submenu (scene, prop, background, clear). + * currently, just implement the effect that click the button once , the submenu will be shown, click the button again, the submenu disappear, do the loop like that + */ + + function SceneBtnClicked(){ + + SceneProxy.visible = true; + + PropProxy.visible = ! SceneProxy.visible; + BackgroundProxy.visible = ! SceneProxy.visible; + } + + + function PropBtnClicked(){ + + PropProxy.visible = true; + + SceneProxy.visible = ! PropProxy.visible; + BackgroundProxy.visible = ! PropProxy.visible; + } + + + function BackgroundBtnClicked(){ + + BackgroundProxy.visible = true; + + SceneProxy.visible = ! BackgroundProxy.visible; + PropProxy.visible = ! BackgroundProxy.visible; + } + + function ClearMenuBtnClicked(){ + + SceneProxy.visible = false; + PropProxy.visible = false; + BackgroundProxy.visible = false; + } + + + + + + +/* + * handle the mouse event occur on the submenu + * + */ + // how to get the object name from the ListWidget, actully, Object name = ListWidget.item[index].text() Is this syntax right? + // how to get the number of index + + + function SceneListItemDoubleClicked(){ + + CurrentClickedItemName = _SceneListWidget.currentItem().text(); + console.LogInfo(_SceneListWidget.objectName); + console.LogInfo("CurrentClicked SceceListItem: " + CurrentClickedItemName); + CheckSelected(CurrentClickedItemName); + } + + function PropListItemDoubleClicked (){ + + CurrentClickedItemName = _PropListWidget.currentItem().text(); + console.LogInfo(_PropListWidget.objectName); + console.LogInfo("CurrentClicked PropListItem: " + CurrentClickedItemName); + CheckSelected(CurrentClickedItemName); + + + } + + function BackgroundListItemDoubleClicked (){ + CurrentClickedItemName = _BackgroundListWidget.currentItem().text(); + console.LogInfo(_BackgroundListWidget.objectName); + console.LogInfo("CurrentClicked BackgroundListItem: " + CurrentClickedItemName); + CheckSelected(CurrentClickedItemName); + } + + + + +function CheckSelected (text){ + //Need to check if all props in one or separate arrays. These have to match the files in Props folder to work. + //Also maybe make the URL a bit more generic to be easier to use anywhere. + + //Just for demo purpose, use the one above in real 1 + var effectArray = ["Beach", "PalmTrees", "Sun", "DaySky"]; + + if(text == null || text == ""){ + console.LogInfo("You havn't selected any effect"); + } + else + { + for(j=0; j + + MainMenu + + + + 0 + 0 + 103 + 212 + + + + true + + + true + + + Form + + + QWidget#MainMenu { background-color: transparent; } +QFrame#frame { background-color: rgba(33, 217, 229,200); + border-radius: 12px;} + +QPushButton#BackgroundBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#SceneBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#PropBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#ClearMenuBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#ClearEntityBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#RandomBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#MumbleBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} + + + + + + 2 + 1 + 101 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + 0 + + + + + 4 + 13 + 93 + 30 + + + + true + + + BackGround + + + + 16 + 16 + + + + + + + 4 + 75 + 93 + 30 + + + + true + + + PROPS + + + + + + 4 + 44 + 93 + 30 + + + + true + + + + + + SCENE + + + + + + 4 + 107 + 93 + 30 + + + + true + + + + + + HomeMenu + + + + + + 4 + 139 + 93 + 30 + + + + true + + + + + + ClearAll + + + + + + 4 + 170 + 93 + 30 + + + + true + + + + + + Random + + + + + + + diff --git a/Scripts/ManMade.ui b/Scripts/ManMade.ui new file mode 100644 index 0000000..5358fd2 --- /dev/null +++ b/Scripts/ManMade.ui @@ -0,0 +1,69 @@ + + + ManMade + + + + 0 + 0 + 132 + 209 + + + + true + + + Form + + + QWidget#ManMade{ background-color: transparent;} +QFrame#frame { background-color: rgba(33, 217, 229, 150); + border-radius: 12px;} + + + + + 1 + -2 + 131 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 12 + 2 + 81 + 20 + + + + <html><head/><body><p><span style=" color:#ffffff;">MAN_MADE:</span></p></body></html> + + + + + + 15 + 21 + 101 + 181 + + + + true + + + + + + + diff --git a/Scripts/MumbleClientWidget.ui b/Scripts/MumbleClientWidget.ui new file mode 100644 index 0000000..77d3ecf --- /dev/null +++ b/Scripts/MumbleClientWidget.ui @@ -0,0 +1,207 @@ + + + MumbleClientWidget + + + Qt::NonModal + + + true + + + + 0 + 0 + 243 + 264 + + + + true + + + /*QWidget#MumbleClientWidget +{ + border: 0px; + windowFlags: 0x00000800; + +}; */ + +QWidget#MumbleClientWidget +{ + border: 0px; + windowFlags: 0x00000800; + background-color: transparent; } +QFrame#frame { +windowFlags: 0x00000800; +background-color: rgba(33, 217, 229,200); border-radius: 12px; +} + +QLabel, QPushButton { + font-size: 9pt; +} + +QLabel#labelConnectionStateTitle, #labelChannelNameTitle, #labelControlsTitle, #labelChatTitle { + font-weight: bold; +} + +QPlainTextEdit, QLineEdit, QListWidget { + border: 1px solid grey; +} + +QLineEdit { + border-top: 0px; +} + + + + + 0 + 0 + 243 + 264 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 13 + 6 + 93 + 16 + + + + + 0 + 0 + + + + Channel Users + + + 2 + + + + + + 151 + 230 + 81 + 23 + + + + Disconnect + + + + + + 9 + 170 + 221 + 31 + + + + + + + Qt::AlignCenter + + + + + + 12 + 48 + 211 + 118 + + + + + + + 95 + 204 + 71 + 23 + + + + Deaf Self + + + + + + 11 + 24 + 211 + 21 + + + + + 0 + 0 + + + + + + + + + + 172 + 204 + 61 + 23 + + + + Connect + + + + + + 9 + 230 + 131 + 23 + + + + Open Audio Wizard + + + + + + 8 + 204 + 81 + 23 + + + + Mute Self + + + + + + + diff --git a/Scripts/MumbleConnectWidget.ui b/Scripts/MumbleConnectWidget.ui new file mode 100644 index 0000000..c630024 --- /dev/null +++ b/Scripts/MumbleConnectWidget.ui @@ -0,0 +1,218 @@ + + + ConnectDialog + + + + 0 + 0 + 229 + 202 + + + + true + + + +QWidget#ConnectDialog { background-color: transparent; } +QFrame#frame { background-color: rgba(33, 217, 229,200); border-radius: 12px;} + + + + + -1 + 0 + 231 + 201 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + false + + + + 80 + 34 + 66 + 20 + + + + 1000000 + + + + + + 14 + 34 + 24 + 16 + + + + Port + + + + + true + + + + 80 + 112 + 133 + 20 + + + + + + + 14 + 60 + 48 + 16 + + + + Username + + + + + + 14 + 112 + 42 + 16 + + + + Channel + + + + + + 14 + 8 + 60 + 16 + + + + + 60 + 0 + + + + Host + + + + + + 134 + 158 + 75 + 23 + + + + Cancel + + + + + + 14 + 158 + 75 + 23 + + + + Connect + + + + + false + + + + 80 + 8 + 133 + 20 + + + + + + + 14 + 86 + 48 + 16 + + + + Password + + + + + + 9 + 138 + 211 + 21 + + + + Click button to Connect or Cancel + + + + + false + + + + 80 + 86 + 133 + 20 + + + + QLineEdit::Password + + + + + + 80 + 60 + 133 + 20 + + + + + + + + diff --git a/Scripts/Object.ui b/Scripts/Object.ui new file mode 100644 index 0000000..62be140 --- /dev/null +++ b/Scripts/Object.ui @@ -0,0 +1,69 @@ + + + Object + + + + 0 + 0 + 132 + 209 + + + + true + + + Form + + + QWidget#Object{ background-color: transparent;} +QFrame#frame { background-color: rgba(36,217,87,150); + border-radius: 12px;} + + + + + 1 + -2 + 131 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 12 + 2 + 111 + 20 + + + + <html><head/><body><p><span style=" color:#ffffff;">NATURAL_OBJECTS:</span></p></body></html> + + + + + + 15 + 21 + 101 + 181 + + + + true + + + + + + + diff --git a/Scripts/PropType.ui b/Scripts/PropType.ui new file mode 100644 index 0000000..930d34c --- /dev/null +++ b/Scripts/PropType.ui @@ -0,0 +1,165 @@ + + + PropTypesMenu + + + + 0 + 0 + 102 + 192 + + + + true + + + true + + + Form + + + QWidget#PropTypesMenu { background-color: transparent; } +QFrame#frame { background-color: rgba(33, 217, 229, 150); + border-radius: 12px;} +QPushButton#EffectBtn{ +color:black; +background-color: white; + border-width: 4px; + border-color: rgba(237,29,63,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 15px; +font:bold; + padding-left: 5px; + padding-right: 5px; + } + +QPushButton#ElementBtn +{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(21,122,69,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 15px; +font:bold; + padding-left: 5px; + padding-right: 5px; +} +QPushButton#ManMadeBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 15px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#ObjectBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(36,233,87,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 15px; +font:bold; + padding-left: 5px; + padding-right: 5px;} + + + + + 2 + 1 + 101 + 191 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 5 + 99 + 91 + 31 + + + + true + + + ManMade + + + + + + 5 + 60 + 91 + 31 + + + + true + + + Objects + + + + + + 5 + 21 + 91 + 31 + + + + true + + + + + + Elements + + + + + + 5 + 138 + 91 + 31 + + + + true + + + + + + Effects + + + + + + + diff --git a/Scripts/Scene.ui b/Scripts/Scene.ui new file mode 100644 index 0000000..64fd8ff --- /dev/null +++ b/Scripts/Scene.ui @@ -0,0 +1,69 @@ + + + Scene + + + + 0 + 0 + 132 + 209 + + + + true + + + Form + + + QWidget#Scene{ background-color: transparent;} +QFrame#frame { background-color: rgba(33, 217, 229, 150); + border-radius: 12px;} + + + + + 1 + -2 + 131 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 12 + 2 + 54 + 20 + + + + <html><head/><body><p><span style=" color:#ffffff;">Scene:</span></p></body></html> + + + + + + 15 + 21 + 101 + 181 + + + + true + + + + + + + diff --git a/Scripts/StartMumble.ui b/Scripts/StartMumble.ui new file mode 100644 index 0000000..a42ba5f --- /dev/null +++ b/Scripts/StartMumble.ui @@ -0,0 +1,78 @@ + + + PropTypesMenu + + + + 0 + 0 + 102 + 36 + + + + true + + + true + + + Form + + + QWidget#PropTypesMenu { background-color: transparent; } +QFrame#frame { background-color: rgba(33, 217, 229, 150); + border-radius: 12px;} +QPushButton#MumbleBtn{ +color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 14px; +font:bold; + padding-left: 5px; + padding-right: 5px;} + + + + + + 2 + 1 + 101 + 36 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 5 + 5 + 91 + 26 + + + + true + + + + + + MUMBLE + + + + + + + diff --git a/bak/Background.ui.bak b/bak/Background.ui.bak new file mode 100644 index 0000000..c591b2c --- /dev/null +++ b/bak/Background.ui.bak @@ -0,0 +1,67 @@ + + + Background + + + + 0 + 0 + 110 + 200 + + + + Form + + + QWidget#Background { background-color: transparent; } +QFrame#frame { background-color: rgba(33, 217, 229, 150); + border-radius: 12px;} + + + + + + -1 + 0 + 111 + 201 + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 11 + 28 + 91 + 161 + + + + + + + 10 + 10 + 71 + 16 + + + + <html><head/><body><p><span style=" color:#ffffff;">BACKGROUND:</span></p></body></html> + + + + + + + diff --git a/bak/CreateRefFile.js.bak b/bak/CreateRefFile.js.bak new file mode 100644 index 0000000..b15decc --- /dev/null +++ b/bak/CreateRefFile.js.bak @@ -0,0 +1,64 @@ + + + + + + + + + + + diff --git a/bak/Effect.ui.bak b/bak/Effect.ui.bak new file mode 100644 index 0000000..e09ab39 --- /dev/null +++ b/bak/Effect.ui.bak @@ -0,0 +1,69 @@ + + + Effect + + + + 0 + 0 + 132 + 209 + + + + true + + + Form + + + QWidget#Effect{ background-color: transparent;} +QFrame#frame { background-color: rgba(237,29,63,150); + border-radius: 12px;} + + + + + 1 + -2 + 131 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 12 + 2 + 81 + 20 + + + + <html><head/><body><p><span style=" color:#ffffff;">SPECIAL_FX:</span></p></body></html> + + + + + + 15 + 21 + 101 + 181 + + + + true + + + + + + + diff --git a/bak/Element.ui.bak b/bak/Element.ui.bak new file mode 100644 index 0000000..3a8da6a --- /dev/null +++ b/bak/Element.ui.bak @@ -0,0 +1,68 @@ + + + Element + + + + 0 + 0 + 132 + 209 + + + + true + + + Form + + + QWidget#Element{ background-color: transparent;} +QFrame#frame{ background-color: rgba(21,122,69,150); border-radius: 15px; } + + + + + 1 + -2 + 131 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 12 + 2 + 111 + 20 + + + + <html><head/><body><p><span style=" color:#ffffff;">NATURAL_ELEMENTS:</span></p></body></html> + + + + + + 15 + 21 + 101 + 181 + + + + true + + + + + + + diff --git a/bak/MainMenu.js (2).bak b/bak/MainMenu.js (2).bak new file mode 100644 index 0000000..14878a5 --- /dev/null +++ b/bak/MainMenu.js (2).bak @@ -0,0 +1,702 @@ + + + + +engine.ImportExtension("qt.core"); +engine.ImportExtension("qt.gui"); +//engine.ImportExtension("qt.uitools"); + +/* + * MainMenu includes the submenus(background, prop, scene, clearMenu, clearEntity) + * When you click the buttons ( background, prop, scene) on the interface of MainMenu, it will popup the corresponding submenu at right side of MainMenu + * when you click the button (clearMenu) on the interface of MainMenu, it will hind the submenu in the screen + * when you click the button (clearEntity) on the interface of MainMenu, it will clear all the entities in the scene. + */ + +var SceneList_visible = false; +var BackgroundList_visible = false; +var PropType_visible = false; + +var ElementList_visible = false; +var ObjectList_visible = false; +var EffectList_visible = false; +var ManMadeList_visible = false; + +var CurrentClickedItemName = null; + +var PropTypeProxy = null; +var SceneProxy = null; +var BackgroundProxy = null; +var ElementProxy = null; +var ObjectProxy = null; +var ManMadeProxy = null; +var EffectProxy = null; + +var _SceneListWidget = null; +//var _PropListWidget = null; +var _BackgroundListWidget = null; +var _ElementListWidget = null; +var _ObjectListWidget = null; +var _ManMadeListWidget = null; +var _EffectListWidget = null; + +/* +Use these to get added properties into right positions. Divided into 3 groups. +*/ + +var Scenes = ["Winter", "Mountains", "Meadow", "Forest", "City", "Beach", "Room"]; +var Backgrounds = ["NightSky", "DaySky", "Sunset"]; +var Elements =["Clouds", "Sun", "Moon", "Rainbow", "SnowFlakes", "Rain", "Volcano"]; +var Objects = ["PalmTrees", "Butterflies", "Mushroom", "Tree1", "Tree2", "Rocks", "Walrus", "Bunnies"]; +var ManMade = ["Mob", "SnowMan", "SandCastle", "Rocket", "Parasol", "SandToys", "Tombstone", "Pirates", "Car", "Treasure"]; +var SpecialEffects = ["Fire", "Smoke", "FireWorks", "PinkElephant", "BlackMonolith", "UFO", "Hearts"]; + +var PropType = ["Element","Object","ManMade","Effect"]; + +var AllEffect = [Scenes,Backgrounds,Elements,Objects,ManMade,SpecialEffects]; +var fileName = "/Ref.js"; + +var ScenePos = [ +position1 = {x : -53.98, y: 10.25, z: -73.77}, +position2 = {x : -60.98, y: 7.75, z: -73.77} +]; + +var SkyPropPos = [ +Skyposition1 = {x: -57.33, y: 16.57, z: -79.25}, +Skyposition2 = {x: -53.33, y: 17.07, z: -67.75} +]; + +var GroundPropPos = [ + Groundposition1 = {x: -61.72, y:9.60, z:-67.75}, + //Groundposition2 = {x: ,y: ,z: } + +]; + +var BackgPos = [ +position1 = {x:-52.40 ,y:13.29 ,z:-73.83} +]; + +this.Positions = [ScenePos, GroundPropPos, SkyPropPos, BackgPos]; + + + +function Init() +{ +// load the file "MainMenu.ui" + var _widget = ui.LoadFromFile("Scripts/MainMenu.ui", false); + + var _PropBtn = findChild(_widget, "PropBtn"); + _PropBtn.pressed.connect(PropBtnClicked); // listening to the singal of prop button clicked + + var _SceneBtn = findChild(_widget, "SceneBtn"); + _SceneBtn.pressed.connect(SceneBtnClicked); // listening to the singal of SceneBtn button clicked + + var _BackgroundBtn = findChild(_widget, "BackgroundBtn"); + _BackgroundBtn.pressed.connect(BackgroundBtnClicked); // listening to the singal of background button clicked + + var _ClearMenuBtn = findChild(_widget, "ClearMenuBtn"); + _ClearMenuBtn.pressed.connect(ClearMenuBtnClicked); // listering to the singal of clean menu button clicked + + var _ClearEntityBtn = findChild(_widget,"ClearEntityBtn"); + _ClearEntityBtn.pressed.connect(RemoveAllEntities); // listering to the singal of clean entity button clicked + + var _RandomBtn = findChild(_widget,"RandomBtn"); + _RandomBtn.pressed.connect(RandomButtonClicked); //TODO the function Random() + + //Add connects to elements, man made, special effectts and object buttons. + + var MenuProxy = new UiProxyWidget(_widget); + + ui.AddProxyWidgetToScene(MenuProxy); + MenuProxy.visible = true; + MenuProxy.windowFlags = 0; + + MenuProxy.x = 860; + MenuProxy.y = 25; + +// load the file "Scene.ui" + var _SceneWidget = ui.LoadFromFile("Scripts/Scene.ui", false); + + _SceneListWidget = findChild(_SceneWidget, "SceneListWidget"); + _SceneListWidget.itemDoubleClicked.connect(SceneListItemDoubleClicked); + + SceneProxy = new UiProxyWidget(_SceneWidget); + + ui.AddProxyWidgetToScene(SceneProxy); + SceneProxy.visible = SceneList_visible; // set the SceneList_visibe = false; + SceneProxy.windowFlags = 0; + + SceneProxy.x = 965; // they should be caculated late + SceneProxy.y = 25; + +// load the file "Background.ui" + var _BackgroundWidget = ui.LoadFromFile("Scripts/Background.ui", false); + + _BackgroundListWidget = findChild(_BackgroundWidget,"BackgroundListWidget"); + _BackgroundListWidget.itemDoubleClicked.connect(BackgroundListItemDoubleClicked); // listen to the event of item double clicked in BackgroundListWidget + + BackgroundProxy = new UiProxyWidget(_BackgroundWidget); + + ui.AddProxyWidgetToScene(BackgroundProxy); + BackgroundProxy.visible = BackgroundList_visible; + BackgroundProxy.windowFlags = 0; + + BackgroundProxy.x = 965; // they should be caculated late + BackgroundProxy.y = 25; + + + +// load the file "PropType.ui" + var _PropTypeWidget = ui.LoadFromFile("Scripts/PropType.ui", false); +// TODO check the ElementBtnClicked() wehther we can take param in () or not, if it can, then we can use variable(var) replace concrete button name, e.g. varBtnClicked +// in that case, we just need only one function to deal with the event of button clicked. + _ElementBtn = findChild(_PropTypeWidget,"ElementBtn"); + _ElementBtn.pressed.connect(ElementBtnClicked); // listen to the event of Element button clicked in PropTypeWidget + + _ObjectBtn = findChild(_PropTypeWidget,"ObjectBtn"); + _ObjectBtn.pressed.connect(ObjectBtnClicked); // listen to the event of Object button clicked in PropTypeWidget + + _ManMadeBtn = findChild(_PropTypeWidget,"ManMadeBtn"); + _ManMadeBtn.pressed.connect(ManMadeBtnClicked); // listen to the event of ManMade button clicked in PropTypeWidget + + _EffectBtn = findChild(_PropTypeWidget,"EffectBtn"); + _EffectBtn.pressed.connect(EffectBtnClicked); // listen to the event of Effect button clicked in PropTypeWidget + + + PropTypeProxy = new UiProxyWidget(_PropTypeWidget); + + ui.AddProxyWidgetToScene(PropTypeProxy); + PropTypeProxy.visible = PropType_visible; + PropTypeProxy.windowFlags = 0; + + PropTypeProxy.x = 965; // they should be caculated late + PropTypeProxy.y = 25; + + +// load the file "Element.ui" + var _ElementWidget = ui.LoadFromFile("Scripts/Element.ui", false); + + _ElementListWidget = findChild(_ElementWidget,"ElementListWidget"); + _ElementListWidget.itemDoubleClicked.connect(ElementListItemDoubleClicked); // listen to the event of item double clicked in ElementListWidget + + ElementProxy = new UiProxyWidget(_ElementWidget); + + ui.AddProxyWidgetToScene(ElementProxy); + ElementProxy.visible = ElementList_visible; + ElementProxy.windowFlags = 0; + + ElementProxy.x = 965 + 105; // they should be caculated late + ElementProxy.y = 25 + 13; + +// load the file "Object.ui" + var _ObjectWidget = ui.LoadFromFile("Scripts/Object.ui", false); + + _ObjectListWidget = findChild(_ObjectWidget,"ObjectListWidget"); + _ObjectListWidget.itemDoubleClicked.connect(ObjectListItemDoubleClicked); // listen to the event of item double clicked in ObjectListWidget + + ObjectProxy = new UiProxyWidget(_ObjectWidget); + + ui.AddProxyWidgetToScene(ObjectProxy); + ObjectProxy.visible = ObjectList_visible; + ObjectProxy.windowFlags = 0; + + ObjectProxy.x = 965 + 105; // they should be caculated late + ObjectProxy.y = 25 + 13 ; + +// load the file "ManMade.ui" + var _ManMadeWidget = ui.LoadFromFile("Scripts/ManMade.ui", false); + + _ManMadeListWidget = findChild(_ManMadeWidget,"ManMadeListWidget"); + _ManMadeListWidget.itemDoubleClicked.connect(ManMadeListItemDoubleClicked); // listen to the event of item double clicked in ManMadeListWidget + + ManMadeProxy = new UiProxyWidget(_ManMadeWidget); + + ui.AddProxyWidgetToScene(ManMadeProxy); + ManMadeProxy.visible = ManMadeList_visible; + ManMadeProxy.windowFlags = 0; + + ManMadeProxy.x = 965 + 105; // they should be caculated late + ManMadeProxy.y = 25 + 13 ; + +// load the file "Effect.ui" + var _EffectWidget = ui.LoadFromFile("Scripts/Effect.ui", false); + + _EffectListWidget = findChild(_EffectWidget,"EffectListWidget"); + _EffectListWidget.itemDoubleClicked.connect(EffectListItemDoubleClicked); // listen to the event of item double clicked in EffectListWidget + + EffectProxy = new UiProxyWidget(_EffectWidget); + + ui.AddProxyWidgetToScene(EffectProxy); + EffectProxy.visible = EffectList_visible; + EffectProxy.windowFlags = 0; + + EffectProxy.x = 965 + 105; // they should be caculated late + EffectProxy.y = 25 + 13 ; + + +} + + // when scene button and background button are clicked, then it should hide all sub menus of proptype + /* function clearPropTypeMenu(){ + for(var i= 0; i 0){ + EnableAnims(); + }else + frame.DelayedExecute(1.0).Triggered.connect(EnableAnims); +} + +/* +Animations have to be named 'SceneAnim' or 'PropAnim'. +This function is launched when animations have been loaded into the entity and they are usable. +In this.Positions array 0 = Scene Placement, 1 = Prop Placement and 2 = Background placement +*/ + + +function rnd(n){ + seed = new Date().getTime(); + seed = (seed*9301+49297) % 233280; + return (Math.floor((seed/(233280.0)* n))); +} + +function LoadXML (text){ + + /* + effectArray holds all possible props, scenes or backgrounds that can be added into the 3d world with GUI. The name in array has to be exact same as + the name of the file in /Props/ folder. variable text is GUI's text of chosen button and is used to compare. Use the table made my Tomi & Paula to get + right names for effectArray. + */ + + if(text == null || text == ""){ + console.LogInfo("You havn't selected any effect"); + } + else + { + //Load entity from file, inside Props folder. assets[0] is entity, so scene.LoadSceneXML returns array. + //Create a dynamiccomponent for the entity to check if it has been placed into the world already. This way we wont place them again when adding an new entity. + var assets = scene.LoadSceneXML(asset.GetAsset("Props/" + text + ".txml").DiskSource(), false, false, 0); + var ent = assets[0]; + var id = assets[0].id; + console.LogInfo(ent.name, ent, assets[0].name); + ent.placeable.visible = false; + ent.dynamiccomponent.CreateAttribute('bool', 'Placed'); + if(!ent.animationcontroller && ent.dynamiccomponent.GetAttribute('Placed') == false) + CheckPlacement(ent); + else if(ent.dynamiccomponent.GetAttribute('Placed') == false) + CheckAnims(ent); + } +} + + + +function CheckPlacement(ent){ + //CASE1: Entity has no animations and is not placed yet. We place it and set placed to true, depending on if its prop, scene or background. + //TODO: An array for multiple different locations that the entity can be added in. + if(ent.dynamiccomponent.name == "Prop" || ent.dynamiccomponent.name == "prop"){ + if(ent.dynamiccomponent.GetAttribute('Type') == 'Ground'){ + var idx = rnd(this.Positions[1].length); + var pos = this.Positions[1][idx]; + + }else if(ent.dynamiccomponent.GetAttribute('Type') == 'Sky'){ + var idx = rnd(this.Positions[2].length); + var pos = this.Positions[2][idx]; + }else { + console.LogInfo('DynamicComponent Type: Ground or sky missing'); + var pos = this.Positions[2][1]; + } + + var tm = ent.placeable.transform; + tm.pos.x = pos.x; + tm.pos.y = pos.y; + tm.pos.z = pos.z; + ent.placeable.transform = tm; + ent.placeable.visible = true; + ent.dynamiccomponent.SetAttribute('Placed', true); + + }else if (ent.dynamiccomponent.name == "Scene" || ent.dynamiccomponent.name == "scene"){ + var idx = rnd(this.Positions[0].length); + var pos = this.Positions[0][idx]; + var tm = ent.placeable.transform; + tm.pos.x = pos.x; + tm.pos.y = pos.y; + tm.pos.z = pos.z; + ent.placeable.transform = tm; + ent.placeable.visible = true; + ent.dynamiccomponent.SetAttribute('Placed', true); + + }else if(ent.dynamiccomponent.name == "Background" || ent.dynamiccomponent.name == "background"){ + var idx = rnd(this.Positions[3].length); + var pos = this.Positions[3][idx]; + var tm = ent.placeable.transform; + tm.pos.x = pos.x; + tm.pos.y = pos.y; + tm.pos.z = pos.z; + tm.rot.y = 180; + ent.placeable.transform = tm; + ent.placeable.visible = true; + ent.dynamiccomponent.SetAttribute('Placed', true); + } + +} + +function EnableAnims(ent){ + for(i=0; i 0){ + EnableAnims(); + }else + frame.DelayedExecute(1.0).Triggered.connect(EnableAnims); +} + +/* +Animations have to be named 'SceneAnim' or 'PropAnim'. +This function is launched when animations have been loaded into the entity and they are usable. +In this.Positions array 0 = Scene Placement, 1 = Prop Placement and 2 = Background placement +*/ + + +function rnd(n){ + seed = new Date().getTime(); + seed = (seed*9301+49297) % 233280; + return (Math.floor((seed/(233280.0)* n))); +} + +function LoadXML (text){ + + /* + effectArray holds all possible props, scenes or backgrounds that can be added into the 3d world with GUI. The name in array has to be exact same as + the name of the file in /Props/ folder. variable text is GUI's text of chosen button and is used to compare. Use the table made my Tomi & Paula to get + right names for effectArray. + */ + + if(text == null || text == ""){ + console.LogInfo("You havn't selected any effect"); + } + else + { + //Load entity from file, inside Props folder. assets[0] is entity, so scene.LoadSceneXML returns array. + //Create a dynamiccomponent for the entity to check if it has been placed into the world already. This way we wont place them again when adding an new entity. + var assets = scene.LoadSceneXML(asset.GetAsset("Props/" + text + ".txml").DiskSource(), false, false, 0); + var ent = assets[0]; + var id = assets[0].id; + console.LogInfo(ent.name, ent, assets[0].name); + ent.placeable.visible = false; + ent.dynamiccomponent.CreateAttribute('bool', 'Placed'); + if(!ent.animationcontroller && ent.dynamiccomponent.GetAttribute('Placed') == false) + CheckPlacement(ent); + else if(ent.dynamiccomponent.GetAttribute('Placed') == false) + CheckAnims(ent); + } +} + + + +function CheckPlacement(ent){ + //CASE1: Entity has no animations and is not placed yet. We place it and set placed to true, depending on if its prop, scene or background. + //TODO: An array for multiple different locations that the entity can be added in. + if(ent.dynamiccomponent.name == "Prop" || ent.dynamiccomponent.name == "prop"){ + if(ent.dynamiccomponent.GetAttribute('Type') == 'Ground'){ + var idx = rnd(this.Positions[1].length); + var pos = this.Positions[1][idx]; + + }else if(ent.dynamiccomponent.GetAttribute('Type') == 'Sky'){ + var idx = rnd(this.Positions[2].length); + var pos = this.Positions[2][idx]; + }else { + console.LogInfo('DynamicComponent Type: Ground or sky missing'); + var pos = this.Positions[2][1]; + } + + var tm = ent.placeable.transform; + tm.pos.x = pos.x; + tm.pos.y = pos.y; + tm.pos.z = pos.z; + ent.placeable.transform = tm; + ent.placeable.visible = true; + ent.dynamiccomponent.SetAttribute('Placed', true); + + }else if (ent.dynamiccomponent.name == "Scene" || ent.dynamiccomponent.name == "scene"){ + var idx = rnd(this.Positions[0].length); + var pos = this.Positions[0][idx]; + var tm = ent.placeable.transform; + tm.pos.x = pos.x; + tm.pos.y = pos.y; + tm.pos.z = pos.z; + ent.placeable.transform = tm; + ent.placeable.visible = true; + ent.dynamiccomponent.SetAttribute('Placed', true); + + }else if(ent.dynamiccomponent.name == "Background" || ent.dynamiccomponent.name == "background"){ + var idx = rnd(this.Positions[3].length); + var pos = this.Positions[3][idx]; + var tm = ent.placeable.transform; + tm.pos.x = pos.x; + tm.pos.y = pos.y; + tm.pos.z = pos.z; + tm.rot.y = 180; + ent.placeable.transform = tm; + ent.placeable.visible = true; + ent.dynamiccomponent.SetAttribute('Placed', true); + } + +} + +function EnableAnims(ent){ + for(i=0; i + + MainMenu + + + + 0 + 0 + 103 + 212 + + + + true + + + true + + + Form + + + QWidget#MainMenu { background-color: transparent; } +QFrame#frame { background-color: rgba(33, 217, 229,200); + border-radius: 12px;} + +QPushButton#BackgroundBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#SceneBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#PropBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#ClearMenuBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#ClearEntityBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#RandomBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 12px; +font:bold; + padding-left: 5px; + padding-right: 5px;} + + + + + + 2 + 1 + 101 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 4 + 13 + 93 + 30 + + + + true + + + BackGround + + + + 16 + 16 + + + + + + + 4 + 75 + 93 + 30 + + + + true + + + PROPS + + + + + + 4 + 44 + 93 + 30 + + + + true + + + + + + SCENE + + + + + + 4 + 107 + 93 + 30 + + + + true + + + + + + HomeMenu + + + + + + 4 + 139 + 93 + 30 + + + + true + + + + + + ClearAll + + + + + + 4 + 170 + 93 + 30 + + + + true + + + + + + Random + + + + + + + diff --git a/bak/ManMade.ui.bak b/bak/ManMade.ui.bak new file mode 100644 index 0000000..5358fd2 --- /dev/null +++ b/bak/ManMade.ui.bak @@ -0,0 +1,69 @@ + + + ManMade + + + + 0 + 0 + 132 + 209 + + + + true + + + Form + + + QWidget#ManMade{ background-color: transparent;} +QFrame#frame { background-color: rgba(33, 217, 229, 150); + border-radius: 12px;} + + + + + 1 + -2 + 131 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 12 + 2 + 81 + 20 + + + + <html><head/><body><p><span style=" color:#ffffff;">MAN_MADE:</span></p></body></html> + + + + + + 15 + 21 + 101 + 181 + + + + true + + + + + + + diff --git a/bak/Object.ui.bak b/bak/Object.ui.bak new file mode 100644 index 0000000..62be140 --- /dev/null +++ b/bak/Object.ui.bak @@ -0,0 +1,69 @@ + + + Object + + + + 0 + 0 + 132 + 209 + + + + true + + + Form + + + QWidget#Object{ background-color: transparent;} +QFrame#frame { background-color: rgba(36,217,87,150); + border-radius: 12px;} + + + + + 1 + -2 + 131 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 12 + 2 + 111 + 20 + + + + <html><head/><body><p><span style=" color:#ffffff;">NATURAL_OBJECTS:</span></p></body></html> + + + + + + 15 + 21 + 101 + 181 + + + + true + + + + + + + diff --git a/bak/PropType.ui.bak b/bak/PropType.ui.bak new file mode 100644 index 0000000..930d34c --- /dev/null +++ b/bak/PropType.ui.bak @@ -0,0 +1,165 @@ + + + PropTypesMenu + + + + 0 + 0 + 102 + 192 + + + + true + + + true + + + Form + + + QWidget#PropTypesMenu { background-color: transparent; } +QFrame#frame { background-color: rgba(33, 217, 229, 150); + border-radius: 12px;} +QPushButton#EffectBtn{ +color:black; +background-color: white; + border-width: 4px; + border-color: rgba(237,29,63,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 15px; +font:bold; + padding-left: 5px; + padding-right: 5px; + } + +QPushButton#ElementBtn +{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(21,122,69,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 15px; +font:bold; + padding-left: 5px; + padding-right: 5px; +} +QPushButton#ManMadeBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(29,158,166,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 15px; +font:bold; + padding-left: 5px; + padding-right: 5px;} +QPushButton#ObjectBtn{color:black; +background-color: white; + border-width: 4px; + border-color: rgba(36,233,87,55); + border-style: solid; + border-radius: 7; + padding: 3px; + font-size: 15px; +font:bold; + padding-left: 5px; + padding-right: 5px;} + + + + + 2 + 1 + 101 + 191 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 5 + 99 + 91 + 31 + + + + true + + + ManMade + + + + + + 5 + 60 + 91 + 31 + + + + true + + + Objects + + + + + + 5 + 21 + 91 + 31 + + + + true + + + + + + Elements + + + + + + 5 + 138 + 91 + 31 + + + + true + + + + + + Effects + + + + + + + diff --git a/bak/Scene.ui.bak b/bak/Scene.ui.bak new file mode 100644 index 0000000..64fd8ff --- /dev/null +++ b/bak/Scene.ui.bak @@ -0,0 +1,69 @@ + + + Scene + + + + 0 + 0 + 132 + 209 + + + + true + + + Form + + + QWidget#Scene{ background-color: transparent;} +QFrame#frame { background-color: rgba(33, 217, 229, 150); + border-radius: 12px;} + + + + + 1 + -2 + 131 + 211 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 12 + 2 + 54 + 20 + + + + <html><head/><body><p><span style=" color:#ffffff;">Scene:</span></p></body></html> + + + + + + 15 + 21 + 101 + 181 + + + + true + + + + + + +