public override void Use(GameObject pelaaja, Slot slot, ItemScript item)
 {
     characterPanel = slot.transform.parent.parent.GetComponentInChildren <CharacterPanel>();
     characterPanel.EquipItem(slot, item);
     //CharacterPanel.Instance.EquipItem(slot, item);    //tää oli alunperin
     Debug.Log("You just ate your collectable!");
 }
Esempio n. 2
0
 public override void Start()
 {
     base.Start();
     // player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerInventory>();
     teamPanel = transform.Find("TeamPanel").GetComponent <TeamPanel>();
     charPanel = transform.Find("TeamCharPanel").GetComponent <CharacterPanel>();
 }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
    public Script_UIManager()
    {
        //Create character panel
        Canvas         = GameObject.Find("Canvas");
        CharacterPanel = GameObject.Instantiate(Resources.Load <Script_CharacterPanel>("Prefabs/UI/CharacterPanel"));
        CharacterPanel.Initialise();
        CharacterPanel.transform.SetParent(Canvas.transform);
        CharacterPanel.transform.localPosition = Vector3.zero;
        CharacterPanel.Refresh();
        CharacterPanel.Hide();

        //Create inventory panel
        InventoryPanel = GameObject.Instantiate(Resources.Load <Script_InventoryPanel>("Prefabs/UI/InventoryPanel"));
        InventoryPanel.Initialise();
        InventoryPanel.transform.SetParent(Canvas.transform);
        InventoryPanel.transform.localPosition = Vector3.zero;
        InventoryPanel.Refresh();
        InventoryPanel.Hide();

        //Create shop panel
        ShopPanel = GameObject.Instantiate(Resources.Load <Script_ShopPanel>("Prefabs/UI/ShopPanel"));
        ShopPanel.Initialise();
        ShopPanel.transform.SetParent(Canvas.transform);
        ShopPanel.transform.localPosition = Vector3.zero;
        ShopPanel.Refresh();
        ShopPanel.Hide();
    }
Esempio n. 5
0
        //public CooldownTimer CoolDownTimer = new CooldownTimer();

        private UserInterface()
        {
            CharacterPanel = new CharacterPanel("Character", 20, 120, 320, 440, Color.Wheat);
            InventoryPanel = new InventoryPanel("Inventory", 960, 480, 220, 220, Color.CornflowerBlue);

            ScrollTransformBounds = new CollisionBox(480, 341, 240, 135);
            ViewContainerBounds   = new CollisionBox(0, 100, Constants.SCREEN_WIDTH, (Constants.SCREEN_HEIGHT - 100));

            ScrollTransformBounds.GetPrimRectangle().SetColor(Color.Magenta);
            ViewContainerBounds.GetPrimRectangle().SetColor(Color.Magenta);

            _player          = Player.Instance();
            _topBarBackpanel = JustCombat.GameContent.TopBarBackpanel;
            _actionBarPanel  = JustCombat.GameContent.ActionBarPanel;
            _xpBarFrame      = JustCombat.GameContent.ExperienceBarFrame;
            _playerInfoCard  = new ActorInfoCard(_player, new Vector2(16.0f, 4.0f));
            _targetInfoCard  = new ActorInfoCard(null);
            _cursorInfoPanel = new InfoPanel("", 998, (Constants.SCREEN_HEIGHT - 26), 200, 24, new Color(0.0f, 0.004f, 0.125f, 0.5f), true);
            _fontConsolas13  = JustCombat.GameContent.FontConsolas13;
            _fontCandara10   = JustCombat.GameContent.FontCandara10;
            _experienceBar   = new ExperienceBar(285, 706, 630, 8, null);
            _debug           = false;

            _actorList = new List <Actor>();

            InitCursors();
        }
Esempio n. 6
0
    public void CreateCharPanel(Character c, int numOfStocks)
    {
        CharacterPanel newPanel = Instantiate(charPanelPrefab, charPanelLayout);

        CharacterPanels.Add(newPanel);
        newPanel.SetupPanel(c, numOfStocks);
    }
Esempio n. 7
0
 private void OnSelect(CharacterPanel panel)
 {
     if (panel != this)
     {
         selection.SetActive(false);
     }
 }
Esempio n. 8
0
 public override void Use(GameObject pelaaja, Slot slot, ItemScript item)
 {
     characterPanel = slot.transform.parent.parent.GetComponentInChildren <CharacterPanel>();
     //characterPanel = characterPanel.GetComponentInParent<CharacterPanel>();
     characterPanel.EquipItem(slot, item);
     //CharacterPanel.Instance.EquipItem(slot, item);    //tää oli alunperin
     Debug.Log("You equipped your " + ItemName);
 }
Esempio n. 9
0
    // Use this for initialization
    void Start()
    {
        inputUsername = PlayerPrefs.GetString("username");

        _inventory = inventoryObject.GetComponent <Inventory>();
        _charPanel = characterPanelObject.GetComponent <CharacterPanel>();
        _player    = FindObjectOfType <Player>();
    }
Esempio n. 10
0
    bool CheckPlayer(CharacterPanel player)
    {
        if (player == null)
        {
            return(false);
        }

        return(true);
    }
Esempio n. 11
0
    public UIManager()
    {
        pHealthBar = GameObject.Find("HealthBar_Back");

        ManaPanel.S_Initialize();
        pCharPanel = GameObject.FindObjectOfType <CharacterPanel>();
        pInvPanel  = GameObject.FindObjectOfType <InventoryPanel>();
        InitPanel(pCharPanel);
        InitPanel(pInvPanel);
    }
    public UIManager()
    {
        pHealthBar = GameObject.Find("HealthBar_Back");

        ManaPanel.S_Initialize();
        pCharPanel = GameObject.FindObjectOfType<CharacterPanel>();
        pInvPanel = GameObject.FindObjectOfType<InventoryPanel>();
        InitPanel(pCharPanel);
        InitPanel(pInvPanel);
    }
Esempio n. 13
0
    private void CreateCharacterPanel()
    {
        //Locate the prefab and instantiate it - Set the canvas as parent
        var characterPanelPrefab = Resources.Load <CharacterPanel>("Prefabs/UI/CharacterPanel");

        CharacterPanel = GameObject.Instantiate(characterPanelPrefab);
        CharacterPanel.transform.SetParent(_canvas.transform);
        CharacterPanel.transform.localPosition = Vector3.zero;
        CharacterPanel.Initialise();
    }
Esempio n. 14
0
 // Equip player weapon3
 private void EquipWeapon3()
 {
     player.SetEquippedWeapon(player.weapon3);
     // Update outline
     GameObject.Find("Slot1Button").GetComponentInChildren <Outline>().effectColor = Color.black;
     GameObject.Find("Slot2Button").GetComponentInChildren <Outline>().effectColor = Color.black;
     GameObject.Find("Slot3Button").GetComponentInChildren <Outline>().effectColor = Color.white;
     CharacterPanel.UpdateSheet();
     Debug.Log(player.equippedWeapon.name + " equipped!");
 }
Esempio n. 15
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Esempio n. 16
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != null)
     {
         Destroy(this.gameObject);
     }
     canvasGroup = GetComponent <CanvasGroup>();
 }
Esempio n. 17
0
 void Start()
 {
     btn.onClick.AddListener(() =>
     {
         SelectedChar = this;
         selection.SetActive(true);
         if (OnSelectE != null)
         {
             OnSelectE(this);
         }
     });
 }
Esempio n. 18
0
    public void OnCharSpawn(Character c, int playerNum, int numOfStocks)//sub to charManager
    {
        CharacterPanel cp = GetCharPanel(playerNum);

        if (cp)
        {
            cp.SetupPanel(c, numOfStocks);
        }
        else
        {
            CreateCharPanel(c, numOfStocks);
        }
    }
    // private CharacterPanel() { }
    #endregion

    override protected void Awake()
    {
        base.Awake();
        //Debug.Log()
        //base.Awake();
        //Debug.Log("slots 在子类被,数量:" + slots.Length);
        //Debug.Log(slots == null);
        //Debug.Log(base.slots == null);
        if (null == _instance)
        {
            _instance = this;
        }
    }
Esempio n. 20
0
 public void InitializeUI()
 {
     _characterPanel       = GetComponent <CharacterPanel>();
     _characterPanelNumber = _characterPanel._characterPanelNumber;
     if (_characterPanel._myCharacter == null)
     {
         return;
     }
     _characterStats = _characterPanel._myCharacter._characterStats;
     _characterPanel._myCharacter.GetComponent <CharacterHPMPManager>()?.InitializeUICharacter(this);
     _characterPanel._myCharacter._characterLevelManager?.InitializeUICharacter(this);
     UpdateHPText(_characterStats._maxHealth);  // Cannot put in Awake (It is where we assing max health)
     UpdateMPText(_characterStats._maxMana);
     UpdateSpecialText();
 }
    public void OnCharacterKO(Character c)///NEEDS MODIFYING!!!
    {
        CharacterPanel cp = UIManager.Instance.GetCharPanel(c.playerNumber);

        if (cp.stockCount <= 0)
        {
            CharactersInGame.Remove(c);
            cp.OnCharacterDefeated();
            Destroy(c.gameObject);
        }
        else
        {
            StartCoroutine(RespawnCharacter(c));
            c.OnKnockedOut();
        }
    }
Esempio n. 22
0
    //----------------------
    //PUBLIC METHODS
    //----------------------

    public void Initialize()
    {
        //Find and assign
        InvPanel         = GameObject.FindGameObjectWithTag("InventoryPanel").GetComponent <InventoryPanel>();
        CharPanel        = GameObject.FindGameObjectWithTag("CharacterPanel").GetComponent <CharacterPanel>();
        FinLevelPanel    = GameObject.FindGameObjectWithTag("FinishedLevelPanel").GetComponent <FinishLevelPanel>();
        NotificationText = GameObject.FindGameObjectWithTag("PickupText").GetComponent <Text>();

        //Initialize
        InvPanel.Initialize();
        CharPanel.Initialize();
        FinLevelPanel.Initialize();

        //Hide the panels
        InvPanel.gameObject.SetActive(false);
        CharPanel.gameObject.SetActive(false);
        FinLevelPanel.gameObject.SetActive(false);
        NotificationText.gameObject.SetActive(false);
    }
    void Start()
    {
        teamPanel      = GetComponent <TeamPanel>();
        characterPanel = GetComponent <CharacterPanel>();
        arenaPanel     = GetComponent <ArenaPanel>();

        coinNum.text   = GameServer.data["user"]["coin"];
        goldNum.text   = (string)GameServer.data["user"]["gold"];
        userLevel.text = (string)GameServer.data["user"]["level"];
        userName.text  = GameServer.data["user"]["name"];
        RefreshStamina();

        if (battleFlag > 0)
        {
            battleFlag = 0;
            ClickUnit("Unit2");
            OpenArenaPanel();
        }
    }
Esempio n. 24
0
    public void AñadirPersonaje(Personaje character)
    {
        if (personajes.ContainsKey(character))
        {
            Debug.LogWarning("CharacterInterfaceController::AñadirPersonaje error: Ya existe un personaje así.");
            return;
        }

        if (manager == null)
        {
            Debug.LogWarning("CharacterInterfaceController::AñadirPersonaje error: No existe el manager.");
            return;
        }

        GameObject obj = GameObject.Instantiate(controller.characterInterfacePrefab);

        obj.transform.SetParent(controller.panelCharacterInterface.transform);
        obj.transform.localScale = new Vector3(1, 1, 1);
        obj.GetComponent <RectTransform>().anchoredPosition = new Vector2(60 + 100 * personajes.Count, -25);

        CharacterPanel script = obj.GetComponent <CharacterPanel>();

        script.SetCharacter(character);

        script.boton.onClick.AddListener(() => { manager.characterController.Actualizar(character); });

        EventTrigger trigger = obj.GetComponent <EventTrigger>();

        //Entrar
        EventTrigger.Entry entry = new EventTrigger.Entry();
        entry.eventID = EventTriggerType.PointerEnter;
        entry.callback.AddListener((eventData) => { script.subPanel.SetActive(true); });
        trigger.triggers.Add(entry);
        //Salir
        EventTrigger.Entry exit = new EventTrigger.Entry();
        exit.eventID = EventTriggerType.PointerExit;
        exit.callback.AddListener((eventData) => { script.subPanel.SetActive(false); });
        trigger.triggers.Add(exit);

        script.subPanel.SetActive(false);

        personajes.Add(character, script);
    }
Esempio n. 25
0
 public void ResetProgress(GameObject button, CharacterPanel characterPanel)
 {
     resetSafety--;
     Debug.LogWarning("!!! - Reset in " + resetSafety);
     if (resetSafety == 0)
     {
         if (File.Exists(defaultPath))
         {
             File.Delete(defaultPath);
             characterPanel.Clear();
             Load();
         }
         resetSafety = 3;
         button.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "Reset (" + resetSafety + ")";
     }
     else
     {
         button.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "Reset (" + resetSafety + ")";
     }
 }
Esempio n. 26
0
    public void SetCharacterBox(DisplayCharacterInfo[] displayCharacterInfos, int phraseIndex)
    {
        var characterInfos = displayCharacterInfos.Where(info => info.phraseIndexs.Contains(phraseIndex)).ToList();

        if (characterInfos.Count > 0)
        {
            ClearBox();
            for (int i = 0; i < characterInfos.Count; i++)
            {
                CharacterPanel panel = null;
                if (_cacheCharacterPanelList.Count > i)
                {
                    panel = _cacheCharacterPanelList[i];
                }
                else
                {
                    panel = ResourceManager.Instance.InstantiateViewParts <CharacterPanel>(_content);
                    _cacheCharacterPanelList.Add(panel);
                }
                panel.SetPanel(characterInfos[i]);
            }
        }
    }
Esempio n. 27
0
    private void Awake()
    {
        int locationIndex = ProgressHandler.Instance.StoryProgressIndex;

        // Also needs some optimisation
        for (int i = 0; i < _panels.Length; ++i)
        {
            CharacterPanel panel = _panels[i];

            // Set progress sprites, if it's equal to index don't show anything.
            panel.progressImage.gameObject.SetActive(i != locationIndex);
            panel.progressImage.sprite = i < 1 ? _unlockedSprite : _lockedSprite;

            // Set blur only to those who are active
            panel.blurEffect.enabled = i > locationIndex;

            // Set text to "?" when it is outside of the index
            if (i > locationIndex)
            {
                panel.name.gameObject.SetActive(false);
                panel.text.gameObject.SetActive(false);
            }
        }
    }
Esempio n. 28
0
    // Use this for initialization
    void Start()
    {
        DontDestroyOnLoad(this.gameObject);
        inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<Inventory>();
        characterPanel = GameObject.FindGameObjectWithTag("CharacterPanel").GetComponent<CharacterPanel>();
        eventSystem = GameObject.FindGameObjectWithTag("EventSystem").GetComponent<EventSystem>();

        position = transform.position;
        busy = false;
    }
Esempio n. 29
0
 //直接装备
 public override void Use(Slot slot)
 {
     bool isSuccess = CharacterPanel.Instance().Equip(this, slot);
 }
Esempio n. 30
0
 private void Awake()
 {
     _Instance = this;
 }
Esempio n. 31
0
    IEnumerator StartBattle(List <EnemyStats> enemies)
    {
        DisableCommandCanvas();

        // Reset values
        battleEnded = false;
        playerTeam.Clear();
        allAllies.Clear();
        enemyTeam.Clear();
        allEnemies.Clear();
        turnOrder.Clear();
        statsPanels.Clear();
        turnIndex = -1;
        foreach (Transform child in statsPanel)
        {
            Destroy(child.gameObject);
        }

        // Initialise party members
        foreach (PlayerStats player in PartyManager.instance.partyMembers)
        {
            PlayerStats temp = Instantiate(player);
            temp.InitialiseCharacter();

            CharacterPanel panel = Instantiate(statsPrefab, statsPanel).GetComponent <CharacterPanel>();
            panel.UpdateStats(temp);
            statsPanels[temp] = panel;
            allAllies.Add(temp);

            if (!player.isDead)
            {
                playerTeam.Add(temp);
            }
        }
        foreach (StatsBase player in playerTeam)
        {
            turnOrder.Add(player);
        }

        if (enemies != null)
        {
            AddSetEnemies(enemies);
        }
        else
        {
            AddRandomEnemies();
        }

        // Sort by agility
        turnOrder = turnOrder.OrderByDescending(stat => stat.currentAGI).ToList();

        // Generate first message
        messageText.text = "";

        for (int i = 0; i < enemyTeam.Count; i++)
        {
            if (enemyTeam.Count == 1)
            {
                messageText.text += "A ";
            }
            messageText.text += enemyTeam[i].characterName;
            if (i < enemyTeam.Count - 2)
            {
                messageText.text += ", ";
            }
            else if (i == enemyTeam.Count - 2)
            {
                messageText.text += " and ";
            }
        }
        if (enemyTeam.Count > 1)
        {
            messageText.text += " appear!";
        }
        else
        {
            messageText.text += " appears!";
        }

        UpdateAllStats();
        spriteManager.SetSprites(enemyTeam);

        while (!GameManager.instance.transition.textureHidden)
        {
            yield return(null);
        }

        yield return(new WaitForSeconds(timeToWait * Mathf.CeilToInt(enemyTeam.Count / 2)));

        NextTurn();
    }
Esempio n. 32
0
 public override void Use(Slot slot)
 {
     CharacterPanel.Instance().Equip(this, slot);
     //  base.Use(slot);
 }