Beispiel #1
0
 public void EndMatch()
 {
     LagController.OnMatchFinished();
     SyncChangesController.OnEndMatch();
     _view.OnEndMatch();
     _isPlaying = false;
 }
Beispiel #2
0
 public void UpdateWithDelta(float delta)
 {
     Timer.Update(delta);
     if (!_isPlaying)
     {
         return;
     }
     Entities.Update();
     LagController.Update();
 }
Beispiel #3
0
    private void sendInfo()
    {
        LagController lag     = ModMain.instance.getLagController();
        string        message = "Is running: " + lag.isRunning + "\n" +
                                "Threads: " + lag.getThreadCount() + "\n" +
                                "Interval(ms): " + lag.getInterval() + "\n" +
                                "Burst: " + lag.getBurstAmount() + "\n" +
                                "Mode: " + lag.getMode();

        if (lag.getMode() == LagController.LagMode.LIST)
        {
            message += "\nTargets:\n";
            int i = 0;
            foreach (PhotonPlayer player in lag.getTargets())
            {
                message += (i++) + "- [#" + player.ID + "]" + player.customProperties[PhotonPlayerProperty.name] + "\n";
            }
        }

        ModMain.instance.sendToPlayer(message);
    }
Beispiel #4
0
    public void StartMatch(bool multiplayer)
    {
        var systems = new List <EntitySystem>()
        {
            new MovingSystem()
        };

        if (multiplayer)
        {
            systems.Add(new NetworkMatchSystem());
            systems.Add(new NetworkInputSystem());
        }
        else
        {
            systems.Add(new SinglePlayerMatchSystem());
            systems.Add(new InputControlSystem());
        }
        LagController.OnMatchStarted();
        TimeMachiene.OnStartMatch();
        Entities.Init(systems);
        SyncChangesController.OnStartMatch();
        _view.OnStartMatch();
        _isPlaying = true;
    }
Beispiel #5
0
    public void init(object gm)
    {
        if (File.Exists("log.txt"))
        {
            logOut = File.AppendText("log.txt");
        }
        else
        {
            logOut = File.CreateText("log.txt");
        }
#if DEBUG
        this.debugOut = File.CreateText("debug.log");
#endif

        this.log("====init() was called====");
        try {
            this.fGameManager = (FengGameManagerMKII)gm;
            GameObject go = new GameObject();
            go.name = "ModUI";
            GameObject.DontDestroyOnLoad(go);
            this.modUI = go.AddComponent <ModUI>();

            this.log("----Initializing mod.");
            this.log("Loading the configuration.");
            this.config = ConfigManager.load("config.cfg");
            this.log("Loading settings file.");
            if (File.Exists("settings.json"))
            {
                try {
                    this.settingsObject = JsonObject.fromFile("settings.json");
                    File.Move("settings.json", "settings.json.corrupted" + UnityEngine.Random.Range(0, 10000));
                }catch (JsonException e) {
                    this.log(e);
                    this.settingsObject = new JsonObject();
                }
            }
            else
            {
                this.settingsObject = new JsonObject();
            }

            this.taskManager = new TaskManager();
            gameModInterface = new GameModEventInterface(this);

            this.spawnController = new SpawnController(this.fGameManager, config.get("TitanWaveAmountFunction"), config.get("WaveEndMessage"));

            this.commandBinder = new CommandBinder(this.taskManager);

            this.cManager = new CManager();

            this.nameManager = new NameManager(this.config);
            commandManager   = new CommandManager();

            PhotonNetwork.OnEventCall = this.eventCallback;

            this.averageDamage = float.Parse(config.get("averageDamage"));

            this.log("Initializing extras.");

            this.log("Creating the greeter.");
            greeter = new PlayerGreeter(this);
            this.log("Creating the mod thread.");
            bct  = new MainModThread(this);
            opcm = new OtherPlayerCommandsManager(this.fGameManager);

            thController = new TitanHealthController();

            this.nameChanger = new NameChanger(this);

            this.lagController = new LagController();

            KillCmd.titanName = this.config.get("killTitanName");
            this.setChatLogEnabled(this.getConfig().getBool("chatLogEnabled"));

            this.setUseGas(true);
            this.setUseBlades(true);

            this.log("Registering mod API");
            AoTModAPI.AoTModAPI.setModAPI(this.gameModInterface);

            this.log("Updating values from the settings file.");
            this.log("Starting mod thread.");
            bct.start();
        } catch (System.Exception e) {
            this.log("Error while initializing mod, who knows what will happen.");
            this.log(e);
        }

        this.messagePrefix = this.getConfig().get("messagePrefix");
        this.messageSuffix = this.getConfig().get("messageSuffix");

        this.log("Mod initialized.");

        ModMain.instance = this;
        this.log("Instance: " + ModMain.instance);
        this.commandManager.buildHelpList();
    }