コード例 #1
0
        public virtual void initGroupList()
        {
            GuiPopUpMenuCtrl groupList = findObjectByInternalName("groupList", true);

            int selected = 0;

            if (groupList.size() > 0)
            {
                selected = groupList.getSelected();
            }

            groupList.clear();

            SimGroup root = getRootGroup();

            if (!root.isObject())
            {
                return;
            }
            // Add all non-empty groups.
            scanGroup(root, groupList, 0);

            // Select initial group.
            if (selected != 0 && selected.AsString().isObject())
            {
                groupList.setSelected(selected);
            }
            else
            {
                groupList.setSelected(root.getId());
            }
        }
コード例 #2
0
ファイル: Audio.cs プロジェクト: lukaspj/Torque-BaseGame
        private static int sfxGroupToOldChannel(SimGroup group)
        {
            int id = group.getId();

            for (int index = 0; index < AudioChannels.Count; index++)
            {
                SFXSource audioChannel = AudioChannels[index];
                if (audioChannel.getId() == id)
                {
                    return(index);
                }
            }
            return(-1);
        }
コード例 #3
0
        public virtual void scanGroup(SimGroup group, GuiPopUpMenuCtrl list, int indentLevel)
        {
            // Create a display name for the group.
            string text = group.getName();

            if (text == "")
            {
                text = group.getClassName();
            }

            string internalName = group.getInternalName();

            if (internalName != "")
            {
                text = text + "[" + internalName + "]";
            }

            // Indent the name according to the depth in the hierarchy.

            if (indentLevel > 0)
            {
                text = Util.strrepeat(" ", indentLevel, "") + text;
            }

            // Add it to the list.

            list.add(text, group.getId());

            // Recurse into SimSets with at least one child.

            for (uint i = 0; i < group.getCount(); i++)
            {
                SimObject obj = group.getObject(i);
                if (!obj.isMemberOfClass("SimSet") || obj.call("getCount").AsInt() == 0)
                {
                    continue;
                }

                scanGroup(obj.GetID(), list, indentLevel + 1);
            }
        }
コード例 #4
0
        public static void loadMissionStage2()
        {
            Global.echo("*** Stage 2 load");

            // Create the mission group off the ServerGroup
            Globals.SetString("instantGroup", "ServerGroup");

            // Make sure the mission exists
            string file = Globals.GetString("Server::MissionFile");

            if (!Global.isFile(file))
            {
                Globals.SetString("Server::LoadFailMsg", "Could not find mission \"" + file + "\"");
            }
            else
            {
                // Calculate the mission CRC.  The CRC is used by the clients
                // to caching mission lighting.
                Globals.SetInt("missionCRC", Global.getFileCRC(file));

                // Exec the mission.  The MissionGroup (loaded components) is added to the ServerGroup
                Global.exec(file);

                if (!Global.isObject("MissionGroup"))
                {
                    Globals.SetString("Server::LoadFailMsg", "No 'MissionGroup' found in mission \"" + file + "\".");
                }
            }

            SimSet ClientGroup = Sim.FindObject <SimSet>("ClientGroup");

            if (Globals.GetString("Server::LoadFailMsg") != "")
            {
                // Inform clients that are already connected
                for (uint clientIndex = 0; clientIndex < ClientGroup.getCount(); clientIndex++)
                {
                    Message.messageClient(ClientGroup.getObject(clientIndex).As <GameConnectionToClient>(), "MsgLoadFailed".Tag(), Globals.GetString("Server::LoadFailMsg"));
                }
                return;
            }

            Torque3D.LevelInfo TheLevelInfo = Sim.FindObject <Torque3D.LevelInfo>("TheLevelInfo");

            // Set mission name.
            if (Global.isObject("TheLevelInfo"))
            {
                Globals.SetString("Server::MissionName", TheLevelInfo.getFieldValue("levelName"));
            }

            // Mission cleanup group.  This is where run time components will reside.  The MissionCleanup
            // group will be added to the ServerGroup.
            SimGroup MissionCleanup = new SimGroup("MissionCleanup", true);

            // Make the MissionCleanup group the place where all new objects will automatically be added.
            Globals.SetInt("instantGroup", MissionCleanup.getId());

            // Construct MOD paths
            Global.pathOnMissionLoadDone();

            // Mission loading done...
            Global.echo("*** Mission loaded");

            // Start all the clients in the mission
            Globals.SetBool("missionRunning", true);
            for (uint clientIndex = 0; clientIndex < ClientGroup.getCount(); clientIndex++)
            {
                ClientGroup.getObject(clientIndex).As <GameConnectionToClient>().loadMission();
            }

            // Go ahead and launch the game
            //todo onMissionStart
            TheLevelInfo.call("onMissionStart");
        }