Пример #1
0
        public MokeponListCanvas(List <Mokepon> pokemons)
        {
            poks = pokemons;
            if (pokemons.Count > 6)
            {
                throw new ApplicationException("Player has more than 6 Mokepons!");
            }

            if (pokemons.Count == 0)
            {
                throw new ApplicationException("Player has no Mokemons!");
            }

            Elements.Add(new Image("BlueBackground"));
            ButtonRows = 2;

            foreach (var pok in pokemons)
            {
                Buttons.Add(new MokeponOverview(pok, Vector2.Zero));
                HighlightEffect he = new HighlightEffect(Color.LightGray);
                (Buttons.Last() as MokeponOverview).Background.AddEffect("HighlightEffect", ref he);
            }

            for (int i = pokemons.Count; i < 6; ++i)
            {
                Elements.Add(new Image("White", new Rectangle(20 + (i / 2) * 420, 180 + (i % 2) * 220, 400, 200), 0.8f));
            }

            (Buttons[0] as MokeponOverview).Background.ActivateEffect("HighlightEffect");
        }
 void OnValidate()
 {
     if (m_HighlightEffect == null)
     {
         m_HighlightEffect = GetComponentInChildren <HighlightEffect>();
     }
 }
Пример #3
0
    IEnumerator Highlight(GameObject go, Color color, float time)
    {
        HighlightEffect.AddHighlight(go, color);
        yield return(new WaitForSeconds(time));

        HighlightEffect.RemoveHighlight(go);
    }
Пример #4
0
 void Update()
 {
     if (!done)
     {
         done = true;
         HighlightEffect.AddHighlight(gameObject, color);
     }
 }
Пример #5
0
        private void SetDefaultHighLight()
        {
            HighlightEffect highlightEffect = GetComponent <HighlightEffect>();

            if (highlightEffect == null)
            {
                return;
            }

            highlightEffect.outlineColor = _savedColor;
        }
Пример #6
0
 public StandardMaterialData(IStandardMaterial material)
 {
     DiffuseColor       = material.DiffuseColor;
     DiffuseMap         = material.DiffuseMap;
     NormalMap          = material.NormalMap;
     Sampler            = material.Sampler;
     IgnoreLighting     = material.IgnoreLighting;
     NoSpecular         = material.NoSpecular;
     HasTransparency    = material.HasTransparency;
     HighlightEffect    = material.HighlightEffect;
     RtTransparencyMode = material.RtTransparencyMode;
 }
Пример #7
0
 void OnMouseUpAsButton()
 {
     if (enabled && requirement == "" && !ScoreTracker.instance.isSummaryShowing)
     {
         if (selected != null)
         {
             HighlightEffect.RemoveHighlight(selected.gameObject);
         }
         HighlightEffect.AddHighlight(gameObject, selectionColor, true);
         selected             = this;
         BuildMenu.activeTool = this;
     }
 }
Пример #8
0
 private void Init()
 {
     highlightEffect = gameObject.AddComponent <HighlightEffect>();
     if (m_HighLightProfile)
     {
         highlightEffect.profile = m_HighLightProfile;
         m_HighLightProfile.Load(highlightEffect);
     }
     highlightEffect.SetHighlighted(false);
     highlightEffect.cullBackFaces = false;
     highlightEffect.glowQuality   = HighlightPlus.QualityLevel.Highest;
     highlightEffect.glowHQColor   = m_GlowColor;
     highlightEffect.overlay       = 0.0f;
 }
Пример #9
0
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Deactivate Tutorial Buttons Highlight Effects
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 protected void DeactivateTutorialButtonsHighlightEffects(int tutorialPointID)
 {
     foreach (Button_TutorialPointOfInterest button in m_arTutorialPhases[tutorialPointID].rButtons)
     {
         if (button != null)
         {
             HighlightEffect he = button.GetComponent <HighlightEffect>();
             if (he != null)
             {
                 he.enabled = false;
                 he.Reset();
             }
         }
     }
 }
Пример #10
0
 public void BuildingComplete(string type)
 {
     if (type == requirement)
     {
         requirement = "";
         CostDisplay cost = GetComponentInChildren <CostDisplay>(true);
         if (cost != null)
         {
             cost.gameObject.SetActive(true);
         }
         foreach (Renderer render in GetComponentsInChildren <Renderer>())
         {
             render.enabled = true;
         }
         HighlightEffect.RemoveHighlight(gameObject);
     }
 }
Пример #11
0
        public void Init()
        {
            JointPoints = gameObject.GetComponentsInChildren <JointPoint>().ToList();

            foreach (JointPoint jointPoint in JointPoints)
            {
                jointPoint.Init(this);
                jointPoint.OnJointEnter += JointPointOnJointEnter;
                jointPoint.OnJointExit  += JointPointOnJointExit;
            }

            _highlightEffect = GetComponent <HighlightEffect>();

            if (_highlightEffect != null)
            {
                _savedColor = _highlightEffect.outlineColor;
            }
        }
Пример #12
0
        private void SetupHighlighter(ref HighlightEffect highlight)
        {
            highlight.overlayColor          = Color.yellow;
            highlight.overlayAnimationSpeed = 0.3f;
            highlight.overlay = 1f;


            highlight.outlineColor = Color.yellow;
            highlight.outline      = 1;

            highlight.glow = 0;

            highlight.seeThrough          = SeeThroughMode.WhenHighlighted;
            highlight.seeThroughTintColor = Color.yellow;
            highlight.seeThroughTintAlpha = 1.0f;
            highlight.seeThroughIntensity = 1;

            highlight.highlighted = true;
        }
Пример #13
0
        private void CreateConnectionPreview()
        {
            if (_jointPreviewCollection == null)
            {
                GameObject o = new GameObject("Joint PreviewCollection");
                _jointPreviewCollection = o.AddComponent <JointPreviewCollection>();
            }

            if (ConnectionPreviews.ContainsKey(gameObject.name))
            {
                ConnectionPreview = ConnectionPreviews[gameObject.name];
            }

            else
            {
                ConnectionPreview = Instantiate(gameObject, _jointPreviewCollection.gameObject.transform, true);
                _saveIter         = 10;
                DestroyComponents();
                HighlightEffect highlightEffect = ConnectionPreview.GetComponent <HighlightEffect>();

                if (highlightEffect != null)
                {
                    highlightEffect.highlighted           = true;
                    highlightEffect.overlay               = 0.75f;
                    highlightEffect.overlayColor          = Color.white;
                    highlightEffect.overlayAnimationSpeed = 0.6f;
                    highlightEffect.outline               = 0;
                    highlightEffect.glowDithering         = false;
                    highlightEffect.glowPasses            = null;
                    highlightEffect.glow       = 0;
                    highlightEffect.seeThrough = SeeThroughMode.Never;
                }

                ConnectionPreviews.Add(gameObject.name, ConnectionPreview);
                _jointPreviewCollection.DrawGameObjects.Add(ConnectionPreview);
                ConnectionPreview.SetActive(false);
            }
        }
Пример #14
0
    // at each late update: //
    public override void lateUpdate()                   // Late Update instead of Update so that the line renderer isn't seen in two places for a frame when turning via the turning locomotion, and probably other situations too
    {
        bool operationsOperated = operations.isOperated();

        targetingRaycastHit = operationsOperated ?
                              potentialHitRaycastingBy
                              (
            raycastingController = operations.firstRelevantController()
                              ) :
                              null;
        lineRenderer.setEnablementTo(operationsOperated);

        GameObject objectRaycasted = targetingRaycastHit.gameObjectIfYull();

        if (targetedObject != objectRaycasted)
        {
                        #if HIGHLIGHT_PLUS
            if (targetHighlight.isYull())
            {
                targetHighlight.finishHighlighting();
                targetHighlight = null;
            }
                        #endif

            targetedObject = objectRaycasted;

                        #if HIGHLIGHT_PLUS
            if (targetedObject)
            {
                targetHighlight = highlightableComponentOfTargetObject.beginGetHighlight(highlighting);
            }
                        #endif

            raycastingController.vibrate(vibrationIntensity);
        }
    }
Пример #15
0
    public void ClickTile(TileGrid world, int x, int y)
    {
        if (enabled && !ScoreTracker.instance.isSummaryShowing)
        {
            if (BuildMenu.activeTool.type == "peep" && !firstTurnWork)
            {
                BuildingPrice.Cost[] workCosts = GetComponent <BuildingPrice>().workCosts;
                if (working || (ContainsPerson(workCosts) && Resources.instance.TryBuy(workCosts)))
                {
                    working = !working;
                    if (!working)
                    {
                        audio.PlayOneShot(workerRemoveSounds[Random.Range(0, workerRemoveSounds.Length)]);
                        foreach (BuildingPrice.Cost cost in workCosts)
                        {
                            if (cost.type != Resources.Type.PERSON && cost.type != Resources.Type.TIME)
                            {
                                ScoreTracker.instance.RemoveExpenses(cost.type, cost.amount);
                            }
                        }
                        Resources.instance.AddResources(workCosts);
                    }
                    else
                    {
                        audio.PlayOneShot(workerPlaceSounds[Random.Range(0, workerPlaceSounds.Length)]);
                        foreach (BuildingPrice.Cost cost in workCosts)
                        {
                            if (cost.type != Resources.Type.PERSON && cost.type != Resources.Type.TIME)
                            {
                                ScoreTracker.instance.AddExpenses(cost.type, cost.amount);
                            }
                        }
                    }
                    foreach (SpecialStates child in GetComponentsInChildren <SpecialStates>(true))
                    {
                        if (child.activeOnWork)
                        {
                            child.gameObject.SetActive(working);
                        }
                    }
                    gameObject.BroadcastMessage("WorkingToggle", SendMessageOptions.DontRequireReceiver);
                    Color highlightColor = HighlightEffect.GetColor(gameObject);
                    if (highlightColor != Color.black)
                    {
                        HighlightEffect.RemoveHighlight(gameObject);
                        HighlightEffect.AddHighlight(gameObject, highlightColor);
                    }
                }
            }
            else if (BuildMenu.activeTool.type == "demo")
            {
                if (canDemolish && (firstTurnWork || !working))
                {
                    world.SetTile(x, y, null);
                    Resources.instance.AddResources(demolishRefund);
                    foreach (BuildingPrice.Cost cost in demolishRefund)
                    {
                        if (cost.type != Resources.Type.PERSON && cost.type != Resources.Type.TIME)
                        {
                            ScoreTracker.instance.RemoveExpenses(cost.type, cost.amount);
                        }
                    }
                    if (working)
                    {
                        BuildingPrice.Cost[] workCosts = GetComponent <BuildingPrice>().workCosts;
                        foreach (BuildingPrice.Cost cost in workCosts)
                        {
                            if (cost.type != Resources.Type.PERSON && cost.type != Resources.Type.TIME)
                            {
                                ScoreTracker.instance.RemoveExpenses(cost.type, cost.amount);
                            }
                        }
                        Resources.instance.AddResources(workCosts);

                        if (firstTurnWork && isFirstTurn)
                        {
                            ++Resources.instance.person;
                        }
                    }
                    SoundEffects.PlaySound(WorldInteraction.instance.buildSound, 0.9f);
                }
                else
                {
                    // TODO (hitch) ERROR (can't demolish)
                }
            }
        }
    }
Пример #16
0
    private int AddToMenu(int i, MenuEntry go)
    {
        Transform menuItem = Instantiate(go.prefab).transform;

        menuItem.gameObject.GetComponent <BuildingPrice>().enabled = true;
        menuItem.parent        = transform;
        menuItem.localPosition = i * (1.57f + ((i % 2 == 1) ? 0.1f : 0)) * Vector3.down + ((i % 2 == 1) ? 1.5f : 0) * Vector3.right + go.yOffset * Vector3.up;
        menuItem.rotation      = itemRotation;
        menuItem.localScale    = Vector3.one;
        foreach (Transform trans in menuItem.gameObject.GetComponentsInChildren <Transform>(true))
        {
            trans.gameObject.layer = gameObject.layer;
        }
        foreach (SpecialStates states in menuItem.GetComponentsInChildren <SpecialStates>())
        {
            if (states.hideInMenu)
            {
                Destroy(states.gameObject);
            }
        }

        BuildingPrice price = menuItem.GetComponent <BuildingPrice>();

        if (price != null)
        {
            price.prefab = go.prefab;
            BuildingPrice.Cost[] costs    = price.buildCosts;
            Transform            costItem = null;
            if (costs.Length > 0)
            {
                costItem                  = Instantiate(costTip).transform;
                costItem.parent           = menuItem;
                costItem.localPosition    = Vector3.zero;
                costItem.localRotation    = Quaternion.identity;
                costItem.localScale       = Vector3.one;
                costItem.gameObject.layer = gameObject.layer;
                CostDisplay display = costItem.GetComponent <CostDisplay>();
                int         q       = 0;
                foreach (BuildingPrice.Cost cost in costs)
                {
                    display.costs[q].sprite.gameObject.SetActive(true);
                    display.costs[q].sprite.sprite = resourcePool.GetIcon(cost.type);
                    display.costs[q].text.text     = cost.amount.ToString();
                    ++q;
                }
            }
            if (price.requirement != "")
            {
                if (costItem != null)
                {
                    costItem.gameObject.SetActive(false);
                }
                foreach (Renderer render in menuItem.GetComponentsInChildren <Renderer>())
                {
                    render.enabled = false;
                }
                HighlightEffect.AddHighlight(menuItem.gameObject, new Color(1, 1, 1), true);
            }
        }

        return(i + 1);
    }
Пример #17
0
 void OnDisable()
 {
     HighlightEffect.RemoveHighlight(gameObject);
     done = false;
 }
Пример #18
0
    void Update()
    {
        GameObject hovering = null;
        RaycastHit hit;
        bool       buildStage = (RoundManager.instance.stage == RoundManager.RoundStage.DAWN || RoundManager.instance.stage == RoundManager.RoundStage.DUSK);

        if (!ScoreTracker.instance.isSummaryShowing && buildStage && menuCamera.ScreenToWorldPoint(Input.mousePosition).x < menuLimiter.position.x && Physics.Raycast(camera.ScreenPointToRay(Input.mousePosition), out hit, Mathf.Infinity, terrainLayer))
        {
            hovering = hit.collider.gameObject;
        }

        if (currentHover != hovering)
        {
            // Remove old:
            if (currentHover != null)
            {
                if (currentTile != null)
                {
                    HighlightEffect.RemoveHighlight(currentTile);

                    BuildingPrice price   = currentTile.GetComponent <BuildingPrice>();
                    CostDisplay   display = currentTile.GetComponentInChildren <CostDisplay>(true);
                    if (price != null && display != null && !price.alwaysShowCost)
                    {
                        display.gameObject.SetActive(false);
                    }
                }
                else
                {
                    HighlightEffect.RemoveHighlight(currentHover);
                }
            }

            // Add new:
            currentPoint = null;
            currentHover = null;
            currentTile  = null;
            if (hovering != null)
            {
                currentPoint = world.GetTerrainPos(hovering);
                if (currentPoint != null)
                {
                    GameObject tile = world.GetTile(currentPoint.x, currentPoint.y);
                    if (tile != null)
                    {
                        HighlightEffect.AddHighlight(tile, blockHoverColor);
                        currentTile = tile;

                        BuildingPrice price   = currentTile.GetComponent <BuildingPrice>();
                        CostDisplay   display = currentTile.GetComponentInChildren <CostDisplay>(true);
                        if (price != null && display != null && !price.alwaysShowCost)
                        {
                            display.gameObject.SetActive(true);
                        }
                    }
                    else
                    {
                        HighlightEffect.AddHighlight(hovering, blockHoverColor);
                    }
                    currentHover = hovering;
                }
            }
        }

        if (!ScoreTracker.instance.isSummaryShowing && buildStage && Input.GetButtonDown("Click") && currentPoint != null)
        {
            if (currentTile == null)
            {
                if (BuildMenu.activeTool != null && BuildMenu.activeTool.isPlaceable && Resources.instance.TryBuy(BuildMenu.activeTool.buildCosts))
                {
                    if (BuildMenu.activeTool.construction != null)
                    {
                        world.SetTile(currentPoint.x, currentPoint.y, BuildMenu.activeTool.construction);
                    }
                    else
                    {
                        world.SetTile(currentPoint.x, currentPoint.y, BuildingPrice.selected.prefab);
                    }
                    HighlightEffect.RemoveHighlight(currentHover);
                    currentHover = null;
                    world.GetTile(currentPoint.x, currentPoint.y).GetComponent <GameTile>().audio.PlayOneShot(buildSound);
                    SoundEffects.PlaySound(buildSound);
                    foreach (BuildingPrice.Cost cost in BuildMenu.activeTool.buildCosts)
                    {
                        if (cost.type != Resources.Type.PERSON && cost.type != Resources.Type.TIME)
                        {
                            ScoreTracker.instance.AddExpenses(cost.type, cost.amount);
                        }
                    }
                }
            }
            else
            {
                currentTile.GetComponent <GameTile>().ClickTile(world, currentPoint.x, currentPoint.y);
            }
        }
    }
Пример #19
0
        private void SetupWithConfig(HightLightConfig config, HighlightEffect newEffect = null)
        {
            if (newEffect != null)
            {
                _effectHolder = newEffect;
            }

            if (config.Outline)
            {
                _effect.outline      = 1;
                _effect.outlineWidth = config.OutlineWidth;
                _effect.outlineColor = config.OutlineColor;
            }
            else
            {
                _effect.outline = 0;
            }

            if (config.Glow)
            {
                _effect.glow      = 1;
                _effect.glowWidth = config.GlowWidth;

                HighlightEffect.GlowPassData glowPass = new HighlightEffect.GlowPassData();
                glowPass.alpha  = config.GlowAlpha;
                glowPass.offset = config.GlowOffset;
                glowPass.color  = config.GlowColor;

                _effect.glowPasses = new [] { glowPass };

                _effect.glowDithering      = false;
                _effect.glowAnimationSpeed = 0;
            }
            else
            {
                _effect.glow = 0;
            }

            if (config.SeeThrough)
            {
                _effect.seeThrough          = HighlightEffect.SeeThroughMode.WhenHighlighted;
                _effect.seeThroughIntensity = config.SeeThroughIntensity;
                _effect.seeThroughTintAlpha = config.SeeThroughAlpha;
                _effect.seeThroughTintColor = config.SeeThroughColor;
            }
            else
            {
                _effect.seeThrough = HighlightEffect.SeeThroughMode.Never;
            }

            if (config.Overlay)
            {
                _effect.overlayColor          = config.OverlayColor;
                _effect.overlay               = config.OverlayAlpha;
                _effect.overlayAnimationSpeed = config.OverlayAnimationSpeed;
            }
            else
            {
                _effect.overlay = 0.0f;
            }

            _effect.Refresh();
        }
Пример #20
0
 public void SetConfiguration(HightLightConfig config, HighlightEffect newEffect = null)
 {
     Configuration = config;
     SetupWithConfig(config, newEffect);
 }
Пример #21
0
        private bool UpdateTooltip(
            string text,
            TooltipControllers controller,
            TooltipButtons button,
            bool buttonGlow,
            bool vibration = true)
        {
            if ((controller == TooltipControllers.Left && !_leftControllerReady) ||
                (controller == TooltipControllers.Right && !_rightControllerReady))
            {
                return(false);
            }

            GameObject tooltipObject;
            Tooltip    tooltip;

            Transform       buttonAttachTransform = null;
            HighlightEffect highlight             = null;


            if ((controller == TooltipControllers.Left && !_tooltipObjectsLeft.ContainsKey(button)) ||
                (controller == TooltipControllers.Right && !_tooltipObjectsRight.ContainsKey(button)))
            {
                buttonAttachTransform = GetButtonTransform(controller, button);

                if (buttonAttachTransform == null)
                {
                    return(false);
                }

                tooltipObject = Instantiate(TooltipTemplate, GetTooltipInstantiationTransform(controller, button));

                if (controller == TooltipControllers.Left)
                {
                    _tooltipObjectsLeft.Add(button, tooltipObject);
                }
                else
                {
                    _tooltipObjectsRight.Add(button, tooltipObject);
                }

                tooltip = InputAdapter.Instance.Tooltip.GetFromChildren(tooltipObject, true);

                tooltip.drawLineTo = buttonAttachTransform;

                buttonAttachTransform.parent.gameObject.AddComponent <HighlightEffect>();

                highlight = buttonAttachTransform.GetComponentInParent <HighlightEffect>();

                SetupHighlighter(ref highlight);

                highlight.enabled = false;
            }
            else
            {
                if (controller == TooltipControllers.Left)
                {
                    tooltipObject = _tooltipObjectsLeft[button];
                }
                else
                {
                    tooltipObject = _tooltipObjectsRight[button];
                }

                tooltip = InputAdapter.Instance.Tooltip.GetFromChildren(tooltipObject, true);
            }

            tooltip.displayText = text;

            tooltip.ResetTooltip();

            if (highlight == null)
            {
                buttonAttachTransform = GetButtonTransform(controller, button);
                highlight             = buttonAttachTransform.GetComponentInParent <HighlightEffect>();
                if (highlight != null)
                {
                    highlight.enabled = false;
                }
            }

            if (text.Trim().Length != 0 || buttonGlow)
            {
                tooltipObject.SetActive(true);

                if (highlight != null)
                {
                    highlight.enabled = buttonGlow;
                }

                if (vibration)
                {
                    Vibrate(controller);
                }
            }
            else
            {
                tooltipObject.SetActive(false);
            }


            return(true);
        }
Пример #22
0
 public DungeonBattle()
 {
     targets      = new List <Monster>();
     characterHit = new HighlightEffect(ConsoleColor.White, ConsoleColor.Red, 2);
     monsterHit   = new HighlightEffect(ConsoleColor.White, ConsoleColor.Red, 2);
 }
Пример #23
0
 void Start()
 {
     effect = GetComponent <HighlightEffect> ();
     effect.OnObjectHighlightStart += ValidateHighlightObject;
 }