Ejemplo n.º 1
0
        public void Initialize(StatusKeeper newKeeper, GUIStatusKeeper neighbor, int displayPosition, float iconScale)
        {
            Keeper          = newKeeper;
            Neighbor        = neighbor;
            DisplayPosition = displayPosition;
            TargetScaleMin  = iconScale;
            TargetScaleMax  = iconScale * 2f;
            TargetScale     = iconScale;

            if (!mInitialized)
            {
                //if we've initialized before we can skip all this other stuff
                //we're just getting reset because a status keeper was added or removed
                mRecentChange           = 0f;
                Keeper.Ping             = false;
                IconSprite.atlas        = Mats.Get.ConditionIconsAtlas;         //TODO implement atlas selection support
                IconSprite.spriteName   = newKeeper.IconName;
                gameObject.name         = newKeeper.Name;
                transform.localPosition = TargetPosition;
                //TODO get colors from Colors
                IconSpriteOverlay.alpha = 0.35f;
                TargetColor             = Colors.Alpha(Colors.BlendThree(Keeper.LowColorValue, Keeper.MidColorValue, Keeper.HighColorValue, Keeper.NormalizedValue), 1f);
                CurrentColor            = TargetColor;
                IconBorder.color        = CurrentColor;
            }

            mInitialized = true;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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);
                }
            }
        }
Ejemplo n.º 4
0
 public void Awake()
 {
     if (Keeper == null || !Keeper.Initialized)
     {
         Keeper = null;
     }
     ButtonHover = gameObject.GetOrAdd <GUIButtonHover> ();
     ButtonHover.OnButtonHover += OnButtonHover;
     tr       = transform;
     Collider = gameObject.GetComponent <BoxCollider> ();
 }
    void registerDelegates(TeamToken controller, bool register)
    {
        StatusKeeper statusKeeper = controller.gameObject.FindComponent <StatusKeeper>();

        if (statusKeeper)
        {
            statusKeeper.onStatusChanged -= checkReleaseFromOwner;
            if (register)
            {
                statusKeeper.onStatusChanged += checkReleaseFromOwner;
            }
        }
    }
Ejemplo n.º 6
0
        public override void CheckIfCompleted()
        {
            HasCompleted = false;
            StatusKeeper statusKeeper = null;

            if (Player.Local.Status.GetStatusKeeper(StatusKeeperName, out statusKeeper))
            {
                HasCompleted = GameData.CheckVariable(CheckType, Value, statusKeeper.NormalizedValue);
                if (HasCompleted)
                {
                    Status |= MissionStatus.Completed;
                }
            }
            FinishedChecking = true;
        }
Ejemplo n.º 7
0
        public IEnumerator SitOverTime()
        {
            StatusKeeper keeper = null;

            Player.Local.Status.GetStatusKeeper("Strength", out keeper);
            while (mSitting)
            {
                Player.Local.Status.RestoreStatus(PlayerStatusRestore.F_Full, "Strength", (float)(ComfortLevel * Globals.RestStrengthRestoreSpeed));
                keeper.Ping = true;
                double start = Frontiers.WorldClock.AdjustedRealTime;
                while (Frontiers.WorldClock.AdjustedRealTime < start + 1f)
                {
                    yield return(null);
                }
            }
        }
    void checkGrantStatus(GameObject go, bool grant)
    {
        StatusKeeper statusKeeper = go.FindComponent <StatusKeeper>();

        if (statusKeeper)
        {
            bool posReq = !requirePositionInTrigger ||
                          coll2d.OverlapPoint(go.transform.position);
            if (grant && posReq)
            {
                statusKeeper.addLayer(PV.ViewID, statusToGrant.Copy());
            }
            else
            {
                statusKeeper.removeLayer(PV.ViewID);
            }
        }
    }
Ejemplo n.º 9
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;
        }
 public void Init(StatusKeeper statusKeeper)
 {
     this.statusKeeper = statusKeeper;
 }
 private void SetAllAllowed(StatusKeeper statusKeeper, List <StatusEffect> effects)
 {
     statusKeeper.AllowedStatus = new StatusLayer(effects);
     EditorUtility.SetDirty(statusKeeper);
     EditorUtility.SetDirty(statusKeeper.gameObject);
 }