Example #1
0
        public void Init(CUIFormScript formScript, GameObject minimapGameObject, GameObject signalSrcHeroNameContainer, bool useSignalButton)
        {
            if (formScript == null)
            {
                return;
            }
            this.m_formScript = formScript;
            this.m_miniMap    = minimapGameObject;
            if (this.m_miniMap != null)
            {
                this.m_miniMapScreenPosition = CUIUtility.WorldToScreenPoint(formScript.GetCamera(), this.m_miniMap.transform.position);
            }
            this.m_signalSrcHeroNameContainer = ((signalSrcHeroNameContainer == null) ? null : signalSrcHeroNameContainer.GetComponent <CUIContainerScript>());
            this.m_signalTipsList             = SignalPanel.GetSignalTipsListScript();
            if (this.m_signalTipsList != null)
            {
                this.m_signalTipsListCanvasGroup = this.m_signalTipsList.gameObject.GetComponent <CanvasGroup>();
                if (this.m_signalTipsListCanvasGroup == null)
                {
                    this.m_signalTipsListCanvasGroup = this.m_signalTipsList.gameObject.AddComponent <CanvasGroup>();
                }
                this.m_signalTipsListCanvasGroup.alpha          = 0f;
                this.m_signalTipsListCanvasGroup.blocksRaycasts = false;
            }
            this.m_useSignalButton = useSignalButton;
            this.m_signalButtons   = new CSignalButton[SignalPanel.s_signalButtonInfos.Length];
            for (int i = 0; i < this.m_signalButtons.Length; i++)
            {
                this.m_signalButtons[i] = new CSignalButton(this.m_formScript.GetWidget(SignalPanel.s_signalButtonInfos[i][1]), SignalPanel.s_signalButtonInfos[i][0]);
                this.m_signalButtons[i].Initialize(this.m_formScript);
                if (!useSignalButton)
                {
                    this.m_signalButtons[i].Disable();
                }
            }
            if (this.m_useSignalButton)
            {
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Battle_ClickMiniMap, new CUIEventManager.OnUIEventHandler(this.OnClickMiniMap));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Battle_Click_Scene, new CUIEventManager.OnUIEventHandler(this.OnClickBattleScene));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Battle_OnSignalButtonClicked, new CUIEventManager.OnUIEventHandler(this.OnSignalButtonClicked));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Battle_OnSignalTipsListElementEnable, new CUIEventManager.OnUIEventHandler(this.OnSignalListElementEnabled));

                this.m_battleSceneGroundPlane = new Plane(new Vector3(0f, 1f, 0f), 0.15f);
                this.m_signals = new ListView <CSignal>();
                this.m_playerSignalCooldowns = new Dictionary <uint, SignalPanel.CPlayerSignalCooldown>();
                this.m_signalTipses          = new ListView <CSignalTipsElement>();
            }
            Singleton <GameEventSys> .instance.AddEventHandler <SpawnSoldierParam>(GameEventDef.Event_SpawnSoldier, new RefAction <SpawnSoldierParam>(this.OnSpawnSoldier));
        }
Example #2
0
        private void OnMiniMap_Click_Down(CUIEvent uievent)
        {
            SignalPanel theSignalPanel = Singleton <CBattleSystem> .GetInstance().TheSignalPanel;

            if (theSignalPanel == null)
            {
                this.Move_CameraToClickPosition(uievent);
            }
            else if (!theSignalPanel.IsUseSingalButton())
            {
                this.Move_CameraToClickPosition(uievent);
            }
        }
Example #3
0
        private void send_signal(CUIEvent uiEvent, GameObject img, int signal_id = 0)
        {
            if ((uiEvent != null) && (img != null))
            {
                byte type    = (byte)uiEvent.m_eventParams.tag2;
                uint tagUInt = uiEvent.m_eventParams.tagUInt;
                if (signal_id == 0)
                {
                    signal_id = uiEvent.m_eventParams.tag3;
                }
                this.Switch(EMapType.Mini);
                SignalPanel panel = (Singleton <CBattleSystem> .GetInstance().FightForm == null) ? null : Singleton <CBattleSystem> .instance.FightForm.GetSignalPanel();

                if (panel != null)
                {
                    switch (type)
                    {
                    case 3:
                    case 1:
                    case 2:
                    case 6:
                    case 4:
                    case 5:
                        panel.SendCommand_SignalMiniMap_Target((byte)signal_id, type, tagUInt);
                        return;
                    }
                    Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                    if (hostPlayer != null)
                    {
                        ActorRoot root = ((hostPlayer == null) || (hostPlayer.Captain == 0)) ? null : hostPlayer.Captain.handle;
                        if (root != null)
                        {
                            Vector2 vector = CUIUtility.WorldToScreenPoint(uiEvent.m_srcFormScript.GetCamera(), img.transform.position);
                            float   num4   = uiEvent.m_pointerEventData.position.x - vector.x;
                            float   num5   = uiEvent.m_pointerEventData.position.y - vector.y;
                            num4 = uiEvent.m_srcFormScript.ChangeScreenValueToForm(num4);
                            num5 = uiEvent.m_srcFormScript.ChangeScreenValueToForm(num5);
                            VInt3 zero = VInt3.zero;
                            zero.x = (int)(num4 * Singleton <CBattleSystem> .GetInstance().UI_world_Factor_Big.x);
                            zero.y = (root == null) ? ((int)0.15f) : ((int)((Vector3)root.location).y);
                            zero.z = (int)(num5 * Singleton <CBattleSystem> .GetInstance().UI_world_Factor_Big.y);
                            panel.SendCommand_SignalMiniMap_Position((byte)signal_id, zero);
                        }
                    }
                }
            }
        }
Example #4
0
        private void send_signal(CUIEvent uiEvent, GameObject img, int signal_id = 0)
        {
            if ((uiEvent != null) && (img != null))
            {
                byte tag          = (byte)uiEvent.m_eventParams.tag;
                byte type         = (byte)uiEvent.m_eventParams.tag2;
                uint tagUInt      = 0;
                uint targetHeroID = 0;
                if (signal_id == 0)
                {
                    signal_id = uiEvent.m_eventParams.tag3;
                }
                if (type == 3)
                {
                    tagUInt      = uiEvent.m_eventParams.tagUInt;
                    targetHeroID = uiEvent.m_eventParams.heroId;
                }
                Singleton <CBattleSystem> .instance.GetMinimapSys().Switch(EMapType.Mini);

                Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                if (hostPlayer != null)
                {
                    ActorRoot root = ((hostPlayer == null) || (hostPlayer.Captain == 0)) ? null : hostPlayer.Captain.handle;
                    if (root != null)
                    {
                        VInt    num5;
                        Vector2 vector = CUIUtility.WorldToScreenPoint(uiEvent.m_srcFormScript.GetCamera(), img.transform.position);
                        Vector3 zero   = Vector3.zero;
                        zero.x = (uiEvent.m_pointerEventData.position.x - vector.x) * Singleton <CBattleSystem> .GetInstance().UI_world_Factor_Big.x;

                        zero.y = (root == null) ? 0.15f : ((Vector3)root.location).y;
                        zero.z = (uiEvent.m_pointerEventData.position.y - vector.y) * Singleton <CBattleSystem> .GetInstance().UI_world_Factor_Big.y;

                        PathfindingUtility.GetGroundY((VInt3)zero, out num5);
                        zero.y = num5.scalar;
                        SignalPanel signalPanel = Singleton <CBattleSystem> .instance.GetSignalPanel();

                        if (signalPanel != null)
                        {
                            signalPanel.SendFrameCommand(signal_id, (int)zero.x, (int)zero.y, (int)zero.z, tag, type, tagUInt, targetHeroID);
                        }
                    }
                }
            }
        }