示例#1
0
    public void ActivatePotion(InventoryMaster.InventoryItem theItem)
    {
        DataLogger.LogMessage("Potion Activated! " + theItem.item.name);
        if (isHijacked)
        {
            return;
        }

        Potion myPot = (Potion)theItem.item;

        PowerUpManager.s.EnablePowerUp(PowerUpManager.PUpTypes.potion,
                                       (int)myPot.myType,
                                       -1,
                                       myPot.amount,
                                       myPot.effectColor);

        if (!GS.a.customCharacterLevel)
        {
            InventoryMaster.s.Remove(theItem);
        }
        else
        {
            List <Potion> myPotions = new List <Potion> (GS.a.potions);
            int           myIndex   = myPotions.IndexOf(myPot);
            GS.a.potionsAmounts[myIndex]--;
        }

        DrawPotionScreen();
    }
示例#2
0
    public void EnableEquipment()
    {
        if (isHijacked)
        {
            DataLogger.LogMessage("Enable Equipment got hijacked");
            return;
        }

        if (equipmentButton.canActivate)
        {
            isLastActivePower   = false;
            lastActivatedButton = true;
            Equipment myEq = (Equipment)(GS.a.customCharacterLevel ? new InventoryMaster.InventoryEquipment(GS.a.equipment, 1) : InventoryMaster.s.activeEquipment).item;

            //Old charge system

            /*if (!DataLogger.isDebugMode)
             *      (myEq).chargeReq.CopyTo (curEquipmentChargeReq, 0);*/

            PowerUpManager.s.EnablePowerUp(PowerUpManager.PUpTypes.equipment,
                                           (int)myEq.myType,
                                           myEq.power,
                                           myEq.amount,
                                           myEq.effectColor);
        }
    }
示例#3
0
    public void OnRoomSetupProgress(float progress)
    {
        // show the default waiting room.


        if (progress == 20)
        {
            if (!showingWaitingRoom)
            {
                DataLogger.LogMessage("Starting game");
                showingWaitingRoom = true;
                PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI();
            }
        }
        else
        {
            DataLogger.LogMessage("Connecting " + ((int)progress).ToString() + "%");
        }

        /*if (progress == 20) {
         *      DataLogger.LogMessage("Starting game");
         *      PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI();
         * } else {
         *      DataLogger.LogMessage("Connecting " + ((int)progress).ToString() + "%");
         * }*/
    }
示例#4
0
 public void ReceiveInvitaion(Invitation invitation, bool shouldAutoAccept)
 {
     DataLogger.LogMessage("Received Invitation");
     shouldAutoAccept = true;
     if (shouldAutoAccept)
     {
         isOnline         = true;
         canPlay          = false;
         searchingForGame = true;
         VC_MultiplayerMenuController.SetSearchingPanelState(true);
         gameInProgress = false;
         gameMode       = invitation.Variant;
         if (gameMode == -1)
         {
             gameMode = 0;
         }
         PlayGamesPlatform.Instance.RealTime.AcceptInvitation(invitation.InvitationId, this);
         if (!showingWaitingRoom)
         {
             PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI();
             showingWaitingRoom = true;
         }
     }
     else
     {
         // The user has not yet indicated that they want to accept this invitation.
         // We should *not* automatically accept it. Rather we store it and
         // display an in-game popup:
         mIncomingInvitation = invitation;
     }
 }
示例#5
0
 public void GetInvitationMatch(int GameVariant)
 {
     if (canPlay)
     {
         isOnline         = true;
         canPlay          = false;
         searchingForGame = true;
         VC_MultiplayerMenuController.SetSearchingPanelState(true);
         gameInProgress = false;
         DataLogger.LogMessage("Initiating Invitation");
         PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI();
         //sInstance = new MultiPlayerConnect();
         //const int MinOpponents = 1, MaxOpponents = 1;
         try {
             gameMode = GameVariant;
             PlayGamesPlatform.Instance.RealTime.CreateWithInvitationScreen((uint)(playerCount - 1), (uint)(playerCount - 1), (uint)GameVariant, this);
             if (!showingWaitingRoom)
             {
                 PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI();
                 showingWaitingRoom = true;
             }
         } catch {
             DataLogger.LogMessage("Invitation Failed");
             canPlay = true;
         }
         //DataLogger.LogMessage("Searching for Room";
     }
     VC_MultiplayerMenuController.s.UpdateMenu();
 }
示例#6
0
    // Use this for initialization
    void Awake()
    {
        if (s != null && s != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            s = this;
        }

        if (!Load())
        {
            mySave = new SaveData();
            if (GS.s == null)
            {
                GS.s = GetComponent <GS> ();
            }
            mySave.levelsCompleted = new bool[GS.s.allModes.Length];
            DataLogger.LogError("Loading failed. creating new save");
        }
        else
        {
            DataLogger.LogMessage("Loading successful");
        }
    }
示例#7
0
    public void Export()
    {
        System.DateTime dt       = System.DateTime.Now;
        string          datetime = dt.ToString("yyyy-MM-dd\\THH-mm-ss\\Z");
        string          path     = Application.persistentDataPath + "\\" + datetime + ".txt";

        //System.IO.File.CreateText (path);
        System.IO.StreamWriter writer = new System.IO.StreamWriter(path, true);

        writer.WriteLine("Version: " + version.text);
        writer.WriteLine("-*-*-*-*-*-*-*-*-*-*-*-");
        writer.WriteLine("");

        writer.WriteLine("Errors:");
        writer.WriteLine("-*-*-*-*-*-*-*-*-*-*-*-");
        foreach (string log in errorBacklog)
        {
            writer.WriteLine(log);
        }

        writer.WriteLine("");
        writer.WriteLine("");
        writer.WriteLine("");
        writer.WriteLine("Messages:");
        writer.WriteLine("-*-*-*-*-*-*-*-*-*-*-*-");
        foreach (string log in errorBacklog)
        {
            writer.WriteLine(log);
        }


        writer.Close();

        DataLogger.LogMessage("Succesfully exported: " + path);
    }
    //This is used when locally selecting a posion card. Network poisoning happens differently+
    public void ChoosePoisonCard(int myPlayerinteger, IndividualCard myCard, string message)
    {
        DataLogger.LogMessage("Player: " + myPlayerinteger.ToString() + " picked Poison card!" + myCard.cBase.myPoisonType + " - " + message);

        switch (myCard.cBase.myPoisonType)
        {
        case CardBase.PoisonTypes.DeadlyPoison:
            DeadlyRoutineHolder myHolder = new DeadlyRoutineHolder(myCard);
            Coroutine           myRout   = StartCoroutine(DeadlyPoisonCard(myPlayerinteger, myCard, myHolder));
            myHolder.routine = myRout;
            ActivatedDeadlyPoisons.Enqueue(myHolder);
            findTheCureUIEffect.SetActive(true);
            break;

        case CardBase.PoisonTypes.PoisonCure:
            if (CureDeadlyPoison())
            {
                myCard.SelectCard(myPlayerinteger);
                myCard.Invoke("MatchCard", 1f);
            }
            else
            {
                myCard.SelectCard(myPlayerinteger);
                myCard.Invoke("UnSelectCard", 1f);
            }
            break;
        }
    }
示例#9
0
    public void CancelMatchSearch()
    {
        PlayGamesPlatform.Instance.RealTime.LeaveRoom();
        DataLogger.LogMessage("Game Search Canceled");

        //Login ();
        VC_MultiplayerMenuController.s.UpdateMenu();
    }
示例#10
0
 public void OnPeersDisconnected(string[] participantIds)
 {
     foreach (string participant in participantIds)
     {
         DataLogger.LogMessage(participant + " Disconnected");
     }
     PlayGamesPlatform.Instance.RealTime.LeaveRoom();
 }
示例#11
0
    /*public void SetMultiplayer () {
     *      ChangeGameMode (multiplayerMode);
     * }*/

    public void ChangeGameMode(GameSettings mode)
    {
        a = null;
        a = mode.Copy();
        activeGameMode   = a.name;
        activeGameModeID = a.id;
        DataLogger.LogMessage("Active Game Settings: " + a.name);
    }
示例#12
0
 protected void PoisonSelectedCards()
 {
     //the card itself will send its poison status across the network
     foreach (IndividualCard card in mem_Cards)
     {
         DataLogger.LogMessage("Poison cards pup not implemented yet!");
         //card.PoisonCard ();
     }
 }
示例#13
0
    public void Add(ItemBase toAdd, int amount)
    {
        DataLogger.LogMessage("Item added: " + toAdd.name);
        InventoryItem myInvItem;

        if (toAdd is Equipment)
        {
            InventoryEquipment myEq = myEquipments.Find(x => x.item.name == toAdd.name);
            myInvItem = new InventoryEquipment((Equipment)toAdd, amount);
            if (myEq != null)
            {
                myEq.chargesLeft += amount;
            }
            else
            {
                myEquipments.Add((InventoryEquipment)myInvItem);
            }

            if (activeEquipment == null)
            {
                EquipItem((InventoryEquipment)myInvItem);
            }
        }
        else if (toAdd is Ingredient)
        {
            InventoryIngredient myIng = myIngredients.Find(x => x.item.name == toAdd.name);
            myInvItem = new InventoryIngredient((Ingredient)toAdd, amount);
            if (myIng != null)
            {
                myIng.chargesLeft += amount;
            }
            else
            {
                myIngredients.Add((InventoryIngredient)myInvItem);
            }
        }
        else
        {
            InventoryPotion myPot = myPotions.Find(x => x.item.name == toAdd.name);
            myInvItem = new InventoryPotion((Potion)toAdd, amount);
            if (myPot != null)
            {
                myPot.chargesLeft += amount;
            }
            else
            {
                myPotions.Add((InventoryPotion)myInvItem);
            }
        }

        if (ItemGainedScreen.s != null)
        {
            ItemGainedScreen.s.ShowGainedItem(myInvItem);
        }

        SaveMaster.s.Save();
    }
示例#14
0
    IEnumerator DelayedEndGame(int i, float delay)
    {
        DataLogger.LogMessage("Delayed ending: " + delay.ToString());
        isGamePlaying = false;
        LocalPlayerController.isActive = false;

        yield return(new WaitForSeconds(delay));

        EndGame(i);
    }
示例#15
0
 public void OnRealTimeMessageReceived(bool isReliable, string senderId, byte[] data)
 {
     DataLogger.LogMessage("Data received " + ((char)data[0]).ToString());
     try {
         DataHandler.s.ReceiveData(data);
         //DataLogger.LogMessage("Data processing begun " + ((char)data [0]).ToString());
     } catch (Exception e) {
         //DataLogger.LogMessage ("Data processing failed " + myCommand.ToString (), true);
         DataLogger.LogError("Data process failed " + ((char)data[0]).ToString(), e);
     }
 }
    public void ActivateFire()
    {
        LocalPlayerController.s.canSelect = true;
        DataLogger.LogMessage("Activating fire");
        lastActiveFire = true;
        PowerUpManager.s.EnablePowerUp(PowerUpManager.PUpTypes.equipment, 4, 4, 1, PowerUpManager.s.dragonColors[2]);

        cardSelect.SetActive(true);
        powerSelect.SetActive(false);

        isDoneFire = true;
    }
示例#17
0
    public void EnablePowerUp(PUpTypes type, int id, int power, float amount, Color effectColor)
    {
        DataLogger.LogMessage("Activating pup: type:^" + type.ToString() + " - id: " + id.ToString() + " - power: " + power.ToString() + " - amount: " + amount.ToString());
        if (canActivatePowerUp == false)
        {
            return;
        }

        if (type == PUpTypes.equipment)
        {
            if (id < equipmentPUps.Length)
            {
                if (equipmentPUps[id] != null)
                {
                    equipmentPUps[id].Enable(power, amount, effectColor);
                    activePUp = equipmentPUps[id];
                }
                else
                {
                    DataLogger.LogError("Equipment pup with id " + id.ToString() + " is null!");
                }
            }
            else
            {
                DataLogger.LogError("Equipment pup with id " + id.ToString() + " not enough Equipment pups! length:" + equipmentPUps.Length.ToString());
            }
        }
        else if (type == PUpTypes.potion)
        {
            if (id < potionPUps.Length)
            {
                if (potionPUps[id] != null)
                {
                    CharacterStuffController.s.lastActivatedButton = false;
                    potionPUps[id].Enable(power, amount, effectColor);
                    activePUp = potionPUps[id];
                }
                else
                {
                    DataLogger.LogError("Potion pup with id " + id.ToString() + " is null!");
                }
            }
            else
            {
                DataLogger.LogError("Potion pup with id " + id.ToString() + " not enough potion pups! length:" + potionPUps.Length.ToString());
            }
        }
        else
        {
            DataLogger.LogError("Other pup types arent implemented/does not exist: " + type.ToString());
        }
    }
示例#18
0
    private void Start()
    {
        DataLogger.LogMessage("Elemental Arena Script Activating...");

        ScoreBoardManager.s.AddScoreHook += ScoreIsAdded;

        CharacterStuffController.s.buttonStateHijack       += ButtonStateHiJack;
        CharacterStuffController.s.isHijacked               = true;
        CharacterStuffController.s.powerUpDisabledCallback += PowerUpDisabledCallback;
        SetUpButtons();

        DataLogger.LogMessage("Elemental Arena Script Activated Succesfully");
    }
示例#19
0
    /*public void LoadTutorial (){
     *      GoogleAPI.gameMode = 0;
     *      LoadLevel (2);
     * }*/

    void LoadLevel(int id)
    {
        if (!levelLoadLock)
        {
            try {
                loadingScreen.SetActive(true);
                DataLogger.LogMessage("Loading level " + id.ToString());
                //print ("Loading level " + id.ToString ());
                SceneManager.LoadSceneAsync(id);
                levelLoadLock = true;
            } catch {
                DataLogger.LogMessage("Level " + id.ToString() + " doesn't exist");
            }
        }
    }
示例#20
0
    public void RandomizeAllCards()
    {
        foreach (IndividualCard card in allCards)
        {
            card.RandomizeCardType();
        }

        //definite drops
        var randCards = GetRandomizedSelectabeCardList();
        int n         = 0;

        if (CardTypeRandomizer.s.forceSpawnCardsCount > 0)
        {
            for (int i = 0; i < CardTypeRandomizer.s.forceSpawnCardsCount; i++)
            {
                int count = 2;
                if (i < GS.a.cardSet.forceSpawnCounts.Length)
                {
                    if (GS.a.cardSet.forceSpawnCounts[i] != 0)
                    {
                        count = GS.a.cardSet.forceSpawnCounts[i];
                    }
                }

                for (int m = 0; m < count; m++)
                {
                    randCards[n].SetCardType(CardTypeRandomizer.s.forceSpawnStartIndex + i);
                    DataLogger.LogMessage("The Card " + randCards[n].x.ToString() + "," + randCards[n].y.ToString() + " is custom set as a pair: " + (CardTypeRandomizer.s.forceSpawnStartIndex + i).ToString());
                    n++;
                }
            }
        }

        if (CardTypeRandomizer.s.forceSpawnItemCount > 0)
        {
            for (int i = 0; i < CardTypeRandomizer.s.forceSpawnItemCount; i++)
            {
                int count = 2;

                for (int m = 0; m < count; m++)
                {
                    randCards[n].SetCardType(CardTypeRandomizer.s.itemStartIndex + CardTypeRandomizer.s.itemCount - i - 1);
                    DataLogger.LogMessage("The Card " + randCards[n].x.ToString() + "," + randCards[n].y.ToString() + " is custom set as a pair: " + (CardTypeRandomizer.s.itemStartIndex + CardTypeRandomizer.s.itemCount - i - 1).ToString());
                    n++;
                }
            }
        }
    }
示例#21
0
 public void SendMessage(byte[] data)
 {
     if (isOnline)
     {
         try {
             PlayGamesPlatform.Instance.RealTime.SendMessageToAll(true, data);
             DataLogger.LogMessage("Data send " + ((char)data[0]).ToString());
         } catch (System.Exception e) {
             DataLogger.LogError("Data failed to send " + ((char)data[0]).ToString(), e);
         }
     }
     else
     {
         //DataLogger.LogMessage ("We are offline",true);
     }
 }
示例#22
0
 public void SendMessage(int playerID, byte[] data)
 {
     if (isOnline)
     {
         try {
             PlayGamesPlatform.Instance.RealTime.SendMessage(true, GetParticipants()[playerID].ParticipantId, data);
             DataLogger.LogMessage("Data send to player: " + playerID.ToString() + " - " + ((char)data[0]).ToString());
         } catch (System.Exception e) {
             DataLogger.LogError("Data failed to send " + ((char)data[0]).ToString(), e);
         }
     }
     else
     {
         //DataLogger.LogMessage ("We are offline",true);
     }
 }
    void UpdateSBoard(int id, bool isDelayed)
    {
        //if (id == SmartScoreboard.s.myPlayer)
        //SmartScoreboard.s.UpdateScore (allScores[SmartScoreboard.s.myPlayer, 0], isDelayed);

        GameObject sBoard = scoreBoards[id];

        if (sBoard != null)
        {
            try {
                sBoard.gameObject.GetComponent <ScorePanel> ().UpdateScore(allScores[id, 0], isDelayed);
            } catch (System.Exception e) {
                DataLogger.LogMessage(e.Message + " - " + e.StackTrace);
            }
        }
    }
示例#24
0
 //this is only done at the end of the game
 public void ReduceEquipmentChargeLeft()
 {
     if (!GS.a.customCharacterLevel)
     {
         DataLogger.LogMessage("Reducing equipment charge");
         if (activeEquipment != null)
         {
             activeEquipment.chargesLeft--;
             DataLogger.LogMessage("Equipment " + activeEquipment.item.name + " charge reduced from "
                                   + (activeEquipment.chargesLeft + 1).ToString() + " to "
                                   + (activeEquipment.chargesLeft).ToString());
             ItemDurabilityLossScreen.s.ShowDurabilityLoss(activeEquipment);
             activeEquipment.chargesLeft++;
             Remove(activeEquipment);
         }
     }
 }
示例#25
0
    public void SendCardType(int targetPlayer, int x, int y, int type)
    {
        try {
            //DataLogger.LogMessage("Sending card type initiate");

            List <byte> toSend = new List <byte> ();
            toSend.AddRange(System.BitConverter.GetBytes((short)x));
            toSend.AddRange(System.BitConverter.GetBytes((short)y));
            toSend.AddRange(System.BitConverter.GetBytes((short)type));


            //DataLogger.LogMessage("Sending card type list made");
            SendData(targetPlayer, a_cardtype, toSend.ToArray());
        } catch (Exception e) {
            DataLogger.LogMessage(e.Message + " - " + e.StackTrace);
        }
    }
示例#26
0
    void GetPlayerIdentity()
    {
        try {
            if (GoogleAPI.s == null)
            {
                GoogleAPI.s = GameObject.FindObjectOfType <GoogleAPI> ();
            }

            if (!GoogleAPI.s.gameInProgress)
            {
                return;
            }

            try {
                myPlayerInteger = (int)GoogleAPI.s.participants.IndexOf(GoogleAPI.s.GetSelf());
            } catch {
                myPlayerInteger = 0;
            }
            try {
                DataLogger.LogMessage(myPlayerInteger.ToString());
            } catch {
            }

            switch (myPlayerInteger)
            {
            case 0:
                myPlayerIdentifier = p_blue;
                break;

            case 1:
                myPlayerIdentifier = p_red;
                break;

            case 2:
                myPlayerIdentifier = p_green;
                break;

            case 3:
                myPlayerIdentifier = p_yellow;
                break;
            }
        } catch (Exception e) {
            DataLogger.LogError(this.name, e);
        }
    }
示例#27
0
 public void OnRoomConnected(bool success)
 {
     DataLogger.LogMessage("OnRoomConnected");
     if (success)
     {
         gameInProgress   = true;
         searchingForGame = false;
         VC_MultiplayerMenuController.SetSearchingPanelState(true);
         DataLogger.LogMessage("Room Connection Successful");
         participants = GetParticipants();
         SceneMaster.s.LoadPlayingLevel(gameMode);
     }
     else
     {
         DataLogger.LogMessage("Room Connection Failure");
         PlayGamesPlatform.Instance.RealTime.LeaveRoom();
     }
 }
    public void ReceiveScore(char player, int scoreType, int totalScore, bool isDelayed)
    {
        try {
            DataLogger.LogMessage("score received");
            int playerInt = DataHandler.s.toInt(player);

            allScores[playerInt, scoreType] = totalScore;

            /*if (scoreType == 0) {
             *      myScores[playerInt, 0] = totalScore;
             * }*/

            UpdateSBoard(playerInt, isDelayed);
            //GameObjectiveMaster.s.CheckReach ();
        } catch (System.Exception e) {
            DataLogger.LogMessage(e.Message + " - " + e.StackTrace);
        }
    }
示例#29
0
    public GameSettings NextLevelInChain()
    {
        DataLogger.LogMessage("Trying to find next level in chain");
        if (activeGameModeID != defaultMode.id)
        {
            int theIndex = -1;
            int n        = 0;
            foreach (GameSettingsArray arr in levelChains)
            {
                for (int i = 0; i < arr.LevelChain.Length; i++)
                {
                    if (arr.LevelChain[i] != null)
                    {
                        print(arr.LevelChain[i].name + "-" + arr.LevelChain[i].id.ToString() + "---" + activeGameMode + "-" + activeGameModeID.ToString());
                    }
                    if (arr.LevelChain[i].id == activeGameModeID)
                    {
                        theIndex = i;
                    }
                }

                if (theIndex != -1)
                {
                    if (theIndex + 1 < arr.LevelChain.Length)
                    {
                        if (arr.LevelChain[theIndex + 1] != null)
                        {
                            DataLogger.LogMessage("Next Level in chain found! " + n.ToString() + " - " + theIndex.ToString());
                            return(arr.LevelChain[theIndex + 1]);
                        }
                    }

                    //we found our level but the next level is not set
                    DataLogger.LogMessage("Next Level in chain NOT FOUND " + activeGameMode);
                    return(null);
                }
                n++;
            }
        }

        //we didnt find our level
        DataLogger.LogMessage("Next Level in chain NOT FOUND " + activeGameMode);
        return(null);
    }
示例#30
0
    public void OnLeftRoom()
    {
        DataLogger.LogMessage("Left Room");

        showingWaitingRoom = false;
        canPlay            = true;

        if (SceneMaster.GetSceneID() != SceneMaster.menuId)
        {
            if (GameObjectiveMaster.s != null)
            {
                GameObjectiveMaster.s.DisconnectedFromGame();
            }
            else
            {
                SceneMaster.s.LoadMenu();
            }
        }
        else
        {
            VC_MultiplayerMenuController.SetSearchingPanelState(false);
        }

        searchingForGame = false;

        // display error message and go back to the menu screen
        gameInProgress = false;

        if (PlayGamesPlatform.Instance != null)
        {
            if (PlayGamesPlatform.Instance.localUser.authenticated)
            {
                canPlay = true;
            }

            //Login ();
            //MultiplayerMenuController.s.UpdateMenu ();
        }

        // (do NOT call PlayGamesPlatform.Instance.RealTime.LeaveRoom() here --
        // you have already left the room!)
    }