Exemplo n.º 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;
        }
Exemplo n.º 2
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;
        }
Exemplo 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);
                }
            }
        }