示例#1
0
 void Start()
 {
     _controller = GameObject.FindGameObjectWithTag(SuriAlFuturo.Tag.GameController).
                   GetComponent <GameController>();
     _dialogueController = _controller.GetComponent <DialogueController>();
     _dockController     = _controller.GetComponent <DockController>();
 }
示例#2
0
    private void InitializeRobot(Robot robot, DockController dock)
    {
        RobotController r = boardController.LoadRobot(robot, dock.transform);

        r.isOpponent = dock.Equals(boardController.opponentDock);
        robotControllers.Add(r.id, r);
        r.transform.localPosition = dock.PlaceInBelt();
        r.transform.localRotation = Quaternion.Euler(0, 0, r.isOpponent ? 180 : 0);
    }
示例#3
0
    void Start()
    {
        _isInterfaceInteractionTriggered = false;

        _gameController = GameObject.FindGameObjectWithTag(SuriAlFuturo.Tag.GameController)
                          .GetComponent <GameController>();
        _dockController = _gameController.GetComponent <DockController>();
        _dockController.Docks.Add(this);
        Suri = _gameController.GetComponent <GameController>().Suri;
    }
示例#4
0
 public DockContainerForm(DockController controller, DockPanel initialPanel)
 {
     EventHandler handler = null;
     this.mTextPadding = new Padding(6, 8, 0, 0);
     this.mFormBorderCurve = 15;
     this.mPanels = new List<DockPanel>();
     this.mOutterDockThreshhold = 30;
     this.mPreviewStyle = DockStyles.None;
     this.mPreviewColor = Color.SkyBlue;
     this.mPreviewOpacity = 100;
     this.DragPaused = true;
     this.mResizeThreshold = 8;
     this.mDockStyle = DockStyles.Fill;
     this.InitializeComponent();
     this.mController = controller;
     this.Controller.Containers.Add(this);
     this.RootContainer = this.RootPanel;
     initialPanel.ContainerControl = this.RootContainer;
     initialPanel.ContainerForm = this;
     initialPanel.DockStyle = DockStyles.Floating;
     initialPanel.OnDocked();
     this.mTitleBar = new DockContainerTitleBar(this);
     this.TitleBarPanel.Height = this.TitleBar.Height;
     if (handler == null)
     {
         handler = delegate (object s, EventArgs e) {
             this.TitleBarPanel.Height = this.TitleBar.Height;
         };
     }
     this.TitleBar.SizeChanged += handler;
     this.TitleBarPanel.Controls.Add(this.TitleBar);
     this.LoadBorder();
     this.OnDocked(initialPanel);
     this.RootContainer.Controls.Add(initialPanel);
     this._Mouse_Moved = new MouseEventHandler(this.Mouse_Moved);
     GlobalHook.Mouse.Moved += this._Mouse_Moved;
     this._Mouse_ButtonDown = new MouseEventHandler(this.Mouse_ButtonDown);
     GlobalHook.Mouse.ButtonDown += this._Mouse_ButtonDown;
     this._Mouse_ButtonUp = new MouseEventHandler(this.Mouse_ButtonUp);
     GlobalHook.Mouse.ButtonUp += this._Mouse_ButtonUp;
 }
示例#5
0
 private void InitializePlayerRobots(Game.Player player, DockController dock)
 {
     player.team.ForEach(r => InitializeRobot(r, dock));
 }
示例#6
0
    protected virtual void PlayEvent(GameEvent[] events, int index)
    {
        if (index == events.Length)
        {
            SetupNextTurn();
            return;
        }
        UnityAction Next = () => PlayEvent(events, index + 1);
        GameEvent   e    = events[index];

        if (history[currentHistoryIndex].IsAfter(e.priority))
        {
            history.Add(SerializeState(turnNumber, e.priority));
            currentHistoryIndex++;
        }
        boardController.DiffBattery(e.primaryBatteryCost, e.secondaryBatteryCost);
        if (e is ResolveEvent)
        {
            ResolveEvent re = (ResolveEvent)e;
            uiController.HighlightCommands(re.priority);
            Counter     animationsToPlay = new Counter(re.GetNumResolutions());
            UnityAction callback         = () => {
                animationsToPlay.Decrement();
                if (animationsToPlay.Get() <= 0)
                {
                    Next();
                }
            };
            re.robotIdToSpawn.ForEach(p => {
                RobotController primaryRobot = robotControllers[p.Item1];
                (primaryRobot.isOpponent ? boardController.opponentDock : boardController.myDock).RemoveFromBelt(primaryRobot.transform.localPosition);
                primaryRobot.transform.parent = boardController.transform;
                boardController.PlaceRobot(primaryRobot, p.Item2.Item1, p.Item2.Item2);
                primaryRobot.displaySpawn(callback);
            });
            re.robotIdToMove.ForEach(p => {
                RobotController primaryRobot = robotControllers[p.Item1];
                primaryRobot.displayMove(ToVector(p.Item2), boardController, callback);
            });
            re.robotIdToHealth.ForEach(t => {
                RobotController primaryRobot = robotControllers[t.Item1];
                primaryRobot.displayDamage(t.Item2, callback);
            });
            if (re.myBatteryHit)
            {
                boardController.GetMyBattery().DisplayDamage(callback);
            }
            if (re.opponentBatteryHit)
            {
                boardController.GetOpponentBattery().DisplayDamage(callback);
            }
            re.missedAttacks.ConvertAll(ToVector).ForEach(v => boardController.DisplayMiss(v, callback));
            re.robotIdsBlocked.ForEach(r => robotControllers[r].DisplayBlocked(callback));
        }
        else if (e is SpawnEvent)
        {
            robotControllers[((SpawnEvent)e).robotId].displaySpawnRequest(Next);
        }
        else if (e is MoveEvent)
        {
            robotControllers[((MoveEvent)e).robotId].displayMoveRequest(ToVector(((MoveEvent)e).destinationPos), Next);
        }
        else if (e is AttackEvent)
        {
            ((AttackEvent)e).locs.ConvertAll(ToVector).ForEach(v => robotControllers[((AttackEvent)e).robotId].displayAttack(v, Next));
        }
        else if (e is DeathEvent)
        {
            robotControllers[((DeathEvent)e).robotId].displayDeath(((DeathEvent)e).returnHealth, (RobotController primaryRobot) =>
            {
                boardController.UnplaceRobot(primaryRobot);
                DockController dock                  = !primaryRobot.isOpponent ? boardController.myDock : boardController.opponentDock;
                primaryRobot.transform.parent        = dock.transform;
                primaryRobot.transform.localPosition = dock.PlaceInBelt();
                Next();
            });
        }
        else if (e is EndEvent)
        {
            EndEvent    evt = (EndEvent)e;
            Counter     animationsToPlay = new Counter((evt.primaryLost ? 1 : 0) + (evt.secondaryLost ? 1 : 0));
            UnityAction callback         = () => {
                animationsToPlay.Decrement();
                if (animationsToPlay.Get() <= 0)
                {
                    uiController.robotButtonContainer.SetButtons(false);
                    uiController.statsInterface.Initialize(evt);
                    gameClient.SendEndGameRequest();
                }
            };
            if (evt.primaryLost)
            {
                boardController.GetMyBattery().DisplayEnd(callback);
            }
            if (evt.secondaryLost)
            {
                boardController.GetOpponentBattery().DisplayEnd(callback);
            }
        }
        else
        {
            PlayEvent(events, index + 1);
        }
    }
示例#7
0
 public DockControlView()
 {
     Controller = new DockController(this);
 }