Beispiel #1
0
        protected IEnumerator WaitForConversationToInitiate()
        {
            while (Conv.Initiating)
            {
                yield return(null);
            }

            //create the reputation status keepers
            int             statusKeeperIndex = -1;
            GUIStatusKeeper lastStatusKeeper  = null;

            for (int i = 0; i < Player.Local.Status.StatusKeepers.Count; i++)
            {
                StatusKeeper sk = Player.Local.Status.StatusKeepers [i];
                if (sk.ShowInConversationInterface)
                {
                    statusKeeperIndex++;
                    GameObject      newGUIStatusKeeperGameObject = NGUITools.AddChild(StatusKeeperParent, GUIPlayerStatusInterface.Get.GUIStatusKeeperPrefab);
                    GUIStatusKeeper newGUIStatusKeeper           = newGUIStatusKeeperGameObject.GetComponent <GUIStatusKeeper> ();
                    newGUIStatusKeeper.Initialize(sk, lastStatusKeeper, statusKeeperIndex, 2f);
                    newGUIStatusKeeper.PositionScale  = -1f;
                    newGUIStatusKeeper.TargetScaleMin = StatusKeeperScaleMin;
                    newGUIStatusKeeper.TargetScaleMax = StatusKeeperScaleMax;
                    StatusKeepers.Add(newGUIStatusKeeper);
                    lastStatusKeeper = newGUIStatusKeeper;
                }
            }

            yield return(null);

            LoadNextExchange();

            yield break;
        }
Beispiel #2
0
        public void GenerateStatusKeepers()
        {
            int             statusKeeperIndex        = -1;
            GUIStatusKeeper previsousGuiStatusKeeper = null;
            GUIStatusKeeper currentGuiStatusKeeper   = null;

            for (int i = 0; i < Player.Local.Status.StatusKeepers.Count; i++)
            {
                StatusKeeper currentStatusKeeper = Player.Local.Status.StatusKeepers[i];
                if (currentStatusKeeper == null)
                {
                    Debug.Log("Status keeper was null!");
                    return;
                }

                bool hasExistingStatusKeeper = false;
                for (int j = 0; j < StatusMeters.Count; j++)
                {
                    if (StatusMeters[j].Keeper == currentStatusKeeper)
                    {
                        currentGuiStatusKeeper  = StatusMeters[j];
                        hasExistingStatusKeeper = true;
                        break;
                    }
                }

                bool showStatusKeeper = currentStatusKeeper.ShowInStatusInterface;
                if (currentStatusKeeper.ShowOnlyWhenAffectedByCondition && currentStatusKeeper.Conditions.Count == 0)
                {
                    //better make sure it has a condition
                    showStatusKeeper = false;
                }

                if (showStatusKeeper)
                {
                    //if we're showing it, bump up the index
                    statusKeeperIndex++;
                    //create a new status keeper if we need one
                    if (!hasExistingStatusKeeper)
                    {
                        GameObject newGUIStatusKeeperGameObject = NGUITools.AddChild(StatusKeeperPanel, GUIStatusKeeperPrefab);
                        currentGuiStatusKeeper             = newGUIStatusKeeperGameObject.GetComponent <GUIStatusKeeper>();
                        currentGuiStatusKeeper.DisplayInfo = this;
                        StatusMeters.Add(currentGuiStatusKeeper);
                    }
                    //initializing an already-initialized status keeper is fine
                    currentGuiStatusKeeper.Initialize(currentStatusKeeper, previsousGuiStatusKeeper, statusKeeperIndex, 1f);                                                            //reverse the order, it will preserve the imporance on screen
                    previsousGuiStatusKeeper = currentGuiStatusKeeper;
                }
                else if (hasExistingStatusKeeper)
                {
                    //if we don't want to show it and it already exists
                    //destroy it and remove it from the list without incrementing anything
                    StatusMeters.Remove(currentGuiStatusKeeper);
                    GameObject.Destroy(currentGuiStatusKeeper);
                }
            }
        }
Beispiel #3
0
        public override void WakeUp()
        {
            base.WakeUp();
            //create stack container displays
            GameObject PlayerInventoryDisplayObject    = NGUITools.AddChild(PlayerInventoryDisplayParent, GUIManager.Get.BarterContainerDisplay);
            GameObject CharacterInventoryDisplayObject = NGUITools.AddChild(CharacterInventoryDisplayParent, GUIManager.Get.BarterContainerDisplay);
            GameObject PlayerGoodsDisplayObject        = NGUITools.AddChild(PlayerGoodsDisplayParent, GUIManager.Get.BarterContainerDisplay);
            GameObject CharacterGoodsDisplayObject     = NGUITools.AddChild(CharacterGoodsDisplayParent, GUIManager.Get.BarterContainerDisplay);

            GameObject PlayerInventoryBankObject    = NGUITools.AddChild(PlayerInventoryBankDisplayParent, GUIManager.Get.InventoryBank);
            GameObject PlayerGoodsBankObject        = NGUITools.AddChild(PlayerGoodsBankDisplayParent, GUIManager.Get.InventoryBank);
            GameObject CharacterInventoryBankObject = NGUITools.AddChild(CharacterInventoryBankDisplayParent, GUIManager.Get.InventoryBank);
            GameObject CharacterGoodsBankObject     = NGUITools.AddChild(CharacterGoodsBankDisplayParent, GUIManager.Get.InventoryBank);

            PlayerInventoryDisplay                      = PlayerInventoryDisplayObject.GetComponent <GUIBarterContainerDisplay> ();
            PlayerInventoryDisplay.BarterMode           = BarterContainerMode.Goods;
            PlayerInventoryDisplay.Party                = BarterParty.Player;
            PlayerInventoryDisplay.EnablerDisplayPrefab = GUIManager.Get.InventorySquareEnablerDisplay;
            PlayerInventoryDisplay.EnablerOffset        = new Vector3(-140f, 50f, 0f);
            PlayerInventoryDisplay.DisplayMode          = StackContainerDisplayMode.TwoRowVertical;
            PlayerInventoryDisplay.FrameSprite.enabled  = false;

            CharacterInventoryDisplay                      = CharacterInventoryDisplayObject.GetComponent <GUIBarterContainerDisplay> ();
            CharacterInventoryDisplay.BarterMode           = BarterContainerMode.Goods;
            CharacterInventoryDisplay.Party                = BarterParty.Character;
            CharacterInventoryDisplay.EnablerDisplayPrefab = GUIManager.Get.InventorySquareEnablerDisplay;
            CharacterInventoryDisplay.EnablerOffset        = new Vector3(-140f, 50f, 0f);
            CharacterInventoryDisplay.DisplayMode          = StackContainerDisplayMode.TwoRowVertical;
            CharacterInventoryDisplay.FrameSprite.enabled  = false;

            CharacterGoodsDisplay                     = CharacterGoodsDisplayObject.GetComponent <GUIBarterContainerDisplay> ();
            CharacterGoodsDisplay.BarterMode          = BarterContainerMode.Offer;
            CharacterGoodsDisplay.Party               = BarterParty.Character;
            CharacterGoodsDisplay.DisplayMode         = StackContainerDisplayMode.TwoRow;
            CharacterGoodsDisplay.FrameSprite.enabled = false;

            PlayerGoodsDisplay                     = PlayerGoodsDisplayObject.GetComponent <GUIBarterContainerDisplay> ();
            PlayerGoodsDisplay.BarterMode          = BarterContainerMode.Offer;
            PlayerGoodsDisplay.Party               = BarterParty.Player;
            PlayerGoodsDisplay.DisplayMode         = StackContainerDisplayMode.TwoRow;
            PlayerGoodsDisplay.FrameSprite.enabled = false;

            PlayerInventoryBank    = PlayerInventoryBankObject.GetComponent <GUIBank> ();
            CharacterInventoryBank = CharacterInventoryBankObject.GetComponent <GUIBank> ();
            PlayerGoodsBank        = PlayerGoodsBankObject.GetComponent <GUIBank> ();
            CharacterGoodsBank     = CharacterGoodsBankObject.GetComponent <GUIBank> ();

            PlayerInventoryBank.DisplayMode    = GUIBank.BankDisplayMode.SmallTwoRows;
            CharacterInventoryBank.DisplayMode = GUIBank.BankDisplayMode.SmallTwoRows;
            PlayerGoodsBank.DisplayMode        = GUIBank.BankDisplayMode.SmallTwoRows;
            CharacterGoodsBank.DisplayMode     = GUIBank.BankDisplayMode.SmallTwoRows;
            //for 'make change' button
            PlayerInventoryBank.Party          = BarterParty.Player;
            PlayerInventoryBank.PrimaryBank    = true;
            CharacterInventoryBank.Party       = BarterParty.Character;
            CharacterInventoryBank.PrimaryBank = true;
            PlayerGoodsBank.Party          = BarterParty.Player;
            PlayerGoodsBank.PrimaryBank    = false;
            CharacterGoodsBank.Party       = BarterParty.Character;
            CharacterGoodsBank.PrimaryBank = false;

            mRefreshBarterGUIAction = Refresh;

                        #if UNITY_EDITOR
            if (VRManager.VRMode | VRManager.VRTestingMode)
            {
                                #else
            if (VRManager.VRMode)
            {
                                #endif
                Vector3 localPosition = transform.localPosition;
                localPosition.y         = -75f;
                transform.localPosition = localPosition;
            }
            StatusKeeper s = null;
            Player.Local.Status.GetStatusKeeper("Personal Reputation", out s);
            StatusKeeperTop.Initialize(s, null, 0, 1f);
            StatusKeeperBot.Initialize(s, null, 0, 1f);
            StatusKeeperTop.DisplayInfo = this;
            StatusKeeperBot.DisplayInfo = this;

            Skill skill = null;
            Skills.Get.SkillByName("Barter", out skill);
            BarterIconBorderTop.color = skill.SkillBorderColor;
            BarterIconBorderBot.color = skill.SkillBorderColor;
            BarterIconTop.color       = skill.SkillIconColor;
            BarterIconBot.color       = skill.SkillIconColor;
            MapIconTop.color          = Color.grey;
            MapIconBot.color          = Color.grey;
            MapIconBorderTop.color    = Color.gray;
            MapIconBorderBot.color    = Color.gray;

            BarterIconBorderBot.transform.parent.GetComponent <GUIButtonHover> ().OnButtonHover += OnHoverOnSkill;
            BarterIconBorderTop.transform.parent.GetComponent <GUIButtonHover> ().OnButtonHover += OnHoverOnSkill;
            MapIconBorderTop.transform.parent.GetComponent <GUIButtonHover> ().OnButtonHover    += OnHoverOnMap;
            MapIconBorderBot.transform.parent.GetComponent <GUIButtonHover> ().OnButtonHover    += OnHoverOnMap;
        }