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.GetValue(typeof(MapDisplay), MapDisplay.Instance, "m_zoomLevelSmooth");
                    for (int i = 0; i < Instance.EnemyMarkers.Count; i++)
                    {
                        Instance.EnemyMarkers[i].CalculateMapPosition(MapDisplay.Instance.CurrentMapScene, i, zoomLevelSmooth * 1.0351562f);
                        At.SetValue(Instance.EnemyMarkers[i].MapPosition, typeof(EnemyMarker), Instance.EnemyMarkers[i], "m_adjustedMapPosition");
                    }
                }

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

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

                return(null);
            }
Exemple #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.SetValue(list.ToArray(), typeof(MapDisplay), MapDisplay.Instance, "m_markerTexts");
 }
            public static void Postfix(MapDisplay __instance)
            {
                var self = __instance;

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

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

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