Exemple #1
0
    /// <summary>Receives input from client and handles it</summary>
    public void TakeInput(int firstElementIndexAtParent, int secondElementIndexAtParent)
    {
        // find first element based on gamePanel's child index
        firstElement = BoardFunctions.GetElementBasedOnParentIndex(elementsPositions, firstElementIndexAtParent);
        // find second element based on gamePanel's child index
        secondElement = BoardFunctions.GetElementBasedOnParentIndex(elementsPositions, secondElementIndexAtParent);
        currentStep   = GameStep.CheckingInput;

        #region  Debug
        //  To use for cheats
        // if (BoardFunctions.GetIfNeighbours(firstElement, secondElement, elementsPositions)) {
        //     AlexDebugger.GetInstance().AddMessage("Correct input: " + BoardFunctions.GetTransformByIndex(firstElement.GetTransformIndex()) + ", with " + BoardFunctions.GetTransformByIndex(secondElement.GetTransformIndex()), AlexDebugger.tags.Input);
        //     // Remove tokens
        //     MoneyManager.ChangeBalanceBy(-MoneyManager.GetSwapCost());
        //     // Swap the elements on the board
        //     BoardFunctions.SwapElements(firstElement, secondElement, this, rewire : false, FixedElementData.swappingSpeed / 2);
        //     // Allow Update() to check if matches are created

        // }
        // else {
        //     // Swap elements, on rewire mode
        //     BoardFunctions.SwapElements(firstElement, secondElement, this, rewire : true);
        //     AddWaitMessage();
        //     SendMessagesToClient();
        //     currentMessageID += 1;
        //     Server.GetServerInstance().SendMessageToClient(new Messages.ServerStatusMessage(currentMessageID, -1, true));

        // }
        #endregion
    }