Example #1
0
            public static Exception Finalizer(MapDisplay __instance, Exception __exception)
            {
                var self = __instance;

                bool flag = !(self.CurrentMapScene.MarkerOffset == Vector2.zero) || !(self.CurrentMapScene.MarkerScale == Vector2.zero);

                if (flag)
                {
                    // update EnemyMarker positions
                    float zoomLevelSmooth = (float)At.GetField(MapDisplay.Instance, "m_zoomLevelSmooth");
                    for (int i = 0; i < EnemyMarkers.Count; i++)
                    {
                        EnemyMarkers[i].CalculateMapPosition(MapDisplay.Instance.CurrentMapScene, i, zoomLevelSmooth * 1.0351562f);
                        At.SetField(EnemyMarkers[i], "m_adjustedMapPosition", EnemyMarkers[i].MapPosition);
                    }
                }

                // update enemy marker texts
                for (int i = 0; i < m_enemyTexts.Count; i++)
                {
                    if (i < EnemyMarkers.Count)
                    {
                        if (!m_enemyTexts[i].gameObject.activeSelf)
                        {
                            m_enemyTexts[i].SetActive(true);
                        }

                        m_enemyTexts[i].UpdateDisplay(EnemyMarkers[i]);
                    }
                    else
                    {
                        if (m_enemyTexts[i].gameObject.activeSelf)
                        {
                            m_enemyTexts[i].SetActive(false);
                        }
                    }
                }

                //if (__exception != null)
                //{
                //    Debug.Log("MapDisplay.UpdateWorldMarkers had an exception!");
                //    Debug.Log(__exception.ToString());
                //}

                return(null);
            }
Example #2
0
        /*
         * AddTextHolder
         * Add another MapWorldMarkerDisplay holder to the MapDisplay.m_markerTexts list.
         * The game will not add more if we use them all, so we have to do it ourselves
         *
         * Note: Since I moved enemies to their own m_enemyTexts holder, we will probably never actually use this.
         * But incase I end up wanting to use more than the default text holders in the future, I'll leave this.
         * The only case I can think it would be used is maybe in Monsoon with MP Limit Remover and like 10+ people in the city.
         */
        private void AddTextHolder(MapWorldMarkerDisplay[] markerTexts)
        {
            // get any existing one to clone from
            var origTextHolder = MapDisplay.Instance.WorldMapMarkers.GetComponentInChildren <MapWorldMarkerDisplay>();
            var origCircle     = origTextHolder.Circle;
            // copy the orig
            var newMarker = Instantiate(origTextHolder.gameObject).GetComponent <MapWorldMarkerDisplay>();

            newMarker.transform.SetParent(MapDisplay.Instance.WorldMapMarkers, false);
            newMarker.RectTransform.localScale = Vector3.one;
            // copy the circle
            newMarker.Circle = Instantiate(origCircle.gameObject).GetComponent <Image>();
            newMarker.Circle.transform.SetParent(origCircle.transform.parent, false);
            newMarker.Circle.transform.localScale = Vector3.one;
            newMarker.Circle.gameObject.SetActive(true);
            // add to list
            var list = markerTexts.ToList();

            list.Add(newMarker);
            // set value
            At.SetField(MapDisplay.Instance, "m_markerTexts", list.ToArray());
        }