Exemple #1
0
 public FightConfig(string tactic, string placement, int cells)
 {
     switch (tactic)
     {
         case "Fuyard":
             this.m_Tactic = TacticEnum.Fuyard;
             break;
         case "Barbare":
             this.m_Tactic = TacticEnum.Barbare;
             break;
         case "Immobile":
             this.m_Tactic = TacticEnum.Immobile;
             break;
     }
     switch (placement)
     {
         case "Immobile":
             this.Placement = PlacementEnum.Immobile;
             break;
         case "Rapproché":
             this.Placement = PlacementEnum.Rapproché;
             break;
         case "Eloigné":
             this.Placement = PlacementEnum.Eloigné;
             break;
     }
     this.m_FarCells = cells;
 }
Exemple #2
0
        public FightConfig(string tactic, string placement, int cells)
        {
            switch (tactic)
            {
            case "Fuyard":
                this.m_Tactic = TacticEnum.Fuyard;
                break;

            case "Barbare":
                this.m_Tactic = TacticEnum.Barbare;
                break;

            case "Immobile":
                this.m_Tactic = TacticEnum.Immobile;
                break;
            }
            switch (placement)
            {
            case "Immobile":
                this.Placement = PlacementEnum.Immobile;
                break;

            case "Rapproché":
                this.Placement = PlacementEnum.Rapproché;
                break;

            case "Eloigné":
                this.Placement = PlacementEnum.Eloigné;
                break;
            }
            this.m_FarCells = cells;
        }
Exemple #3
0
        /// <summary>
        /// Place the character according to the AI positioning.
        /// </summary>
        public void PlaceCharacter(List <int> PlacementCells)
        {
            m_error = 0;
            m_Account.Log(new BotTextInformation("Placement du personnage."), 5);
            try
            {
                PlacementEnum         position = m_AI.GetPositioning();
                int                   distance = -1;
                int                   cell     = -1;
                Dictionary <int, int> cells    = new Dictionary <int, int>();
                foreach (int tempCell in PlacementCells)
                {
                    int      tempDistance = 0;
                    MapPoint cellPoint    = new MapPoint(Convert.ToInt32(tempCell));
                    foreach (BFighter fighter in m_Data.Fighters)
                    {
                        MapPoint fighterPoint = new MapPoint(fighter.CellId);
                        tempDistance += cellPoint.DistanceToCell(fighterPoint);
                    }

                    switch (position)
                    {
                    case PlacementEnum.Eloigné:
                    case PlacementEnum.Far:
                        if (distance < tempDistance || distance == -1)
                        {
                            distance = tempDistance;
                            cell     = Convert.ToInt32(tempCell);
                        }
                        break;

                    case PlacementEnum.Near:
                    case PlacementEnum.Rapproché:
                        if (distance > tempDistance || distance == -1 || tempDistance == 1)
                        {
                            distance = tempDistance;
                            cell     = Convert.ToInt32(tempCell);
                        }
                        break;
                    }
                }
                if (cell != -1)
                {
                    GameFightPlacementPositionRequestMessage msg = new GameFightPlacementPositionRequestMessage((ushort)cell);
                    m_Account.SocketManager.Send(msg);
                }
            }
            catch (Exception ex)
            {
                m_Account.Log(new ErrorTextInformation(ex.Message), 0);
            }
        }
Exemple #4
0
 public override void Reset()
 {
     skin                = null;
     style               = null;
     font                = null;
     minBubbleSize       = new Vector2(64f, 64f);
     bubbleOffset        = 0f;
     bubbleOffsetVector  = Vector2.zero;
     placement           = PlacementEnum.Center;
     color               = Color.white;
     fadeIn              = 0.3f;
     fadeOut             = 0.3f;
     volume              = 1f;
     audioDelay          = 0f;
     guiDepth            = 0;
     debug               = false;
     audioVolume         = null;
     audioVolumeMultiply = false;
     audioPitch          = 1f;
 }
		public override void Reset()
		{
			skin = null;
			style = null;
			font = null;
			minBubbleSize = new Vector2(64f, 64f);
			bubbleOffset = 0f;
			bubbleOffsetVector = Vector2.zero;
			placement = PlacementEnum.Center;
			color = Color.white;
			fadeIn = 0.3f;
			fadeOut = 0.3f;
			volume = 1f;
			audioDelay = 0f;
			guiDepth = 0;
			debug = false;
			audioVolume = null;
			audioVolumeMultiply = false;
			audioPitch = 1f;
		}
		private Vector2 GetbubblePosition(Vector2 bubbleSize, PlacementEnum aPlacement){
			if(aPlacement == PlacementEnum.Default){
				aPlacement = (PlacementEnum)_placement;	
			}
	        //Top Left Position = tlp
	        Vector3 pos = new Vector3();
	        Vector2 tlp = new Vector2();
	        switch (aPlacement)
			{
			    case PlacementEnum.Center:
			    //Debug.Log(Camera.main);
				//Debug.Log(go);
				//Debug.Log("____");
				pos = Camera.main.WorldToScreenPoint(go.transform.position);
			        tlp.x = pos.x;
			        tlp.y = Camera.main.pixelHeight - pos.y;  
			        tlp.x -= bubbleSize.x/2;
			        tlp.y -= bubbleSize.y/2;
			        break;
			    case PlacementEnum.TopCenter:
			        pos = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x + bubbleOffsetVector.x, go.transform.position.y + bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
			        tlp.x = pos.x;
			        tlp.y = Camera.main.pixelHeight - pos.y;  
			    	tlp.x -= bubbleSize.x/2; 
			    	tlp.y -= bubbleSize.y;
			    break;
			    case PlacementEnum.TopLeft:
			        pos = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x -  bubbleOffset + bubbleOffsetVector.x, go.transform.position.y + bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
			        tlp.x = pos.x;
			        tlp.y = Camera.main.pixelHeight - pos.y;  
			    	tlp.x -= bubbleSize.x; 
			    	tlp.y -= bubbleSize.y;
			    break;
			    case PlacementEnum.TopRight:
			        pos = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x  +  bubbleOffset + bubbleOffsetVector.x, go.transform.position.y + bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
			        tlp.x = pos.x;
			        tlp.y = Camera.main.pixelHeight - pos.y;  
			      	tlp.y -= bubbleSize.y;
			    break;
			    case PlacementEnum.BottomCenter:
			        pos = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x + bubbleOffsetVector.x, go.transform.position.y - bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
			        tlp.x = pos.x;
			        tlp.y = Camera.main.pixelHeight - pos.y;  
			    	tlp.x -= bubbleSize.x/2; 
			    break;
			    case PlacementEnum.BottomLeft:
			        pos = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x -  bubbleOffset + bubbleOffsetVector.x, go.transform.position.y - bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
			        tlp.x = pos.x;
			        tlp.y = Camera.main.pixelHeight - pos.y;  
			    	tlp.x -= bubbleSize.x; 
			    break;
			    case PlacementEnum.BottomRight:
			        pos = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x  +  bubbleOffset + bubbleOffsetVector.x, go.transform.position.y - bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
			        tlp.x = pos.x;
			        tlp.y = Camera.main.pixelHeight - pos.y;  
			    break;
			    case PlacementEnum.RightCenter:
			        pos = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x  +  bubbleOffset + bubbleOffsetVector.x, go.transform.position.y + bubbleOffsetVector.y, go.transform.position.z));
			        tlp.x = pos.x;
			        tlp.y = Camera.main.pixelHeight - pos.y;
			        tlp.y -= bubbleSize.y/2;  
			    break;
			    case PlacementEnum.LeftCenter:
			        pos = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x  - bubbleOffset + bubbleOffsetVector.x, go.transform.position.y + bubbleOffsetVector.y, go.transform.position.z));
			        tlp.x = pos.x;
			        tlp.y = Camera.main.pixelHeight - pos.y;
			        tlp.x -= bubbleSize.x;
			        tlp.y -= bubbleSize.y/2;  
			    break;
			    
		    }		
		    return tlp;	
		}
		public override void Reset()
		{
		  	recordingNextEvent = null;
			recordingPrevEvent = null;
								
			style = new FsmString{UseVariable = true};
			placement = PlacementEnum.Default;
			offset = new FsmFloat{UseVariable = true};
			dictionary = new FsmString{UseVariable = true};
			id = new FsmString{Value = "0000"};
			text = new FsmString{UseVariable = true};
			time = new FsmFloat{UseVariable = true};
			delay = new FsmFloat{UseVariable = true};
			finishedEvent = null;
			default_x = new FsmFloat{UseVariable = true};
			default_y = new FsmFloat{UseVariable = true};
			normalized = true;
			delayTmp = 0f;
			timeTmp = 0f;
			depth = null;
			depthTmp = 0;
			audioGameObject = new FsmGameObject{UseVariable = true};
			audioClip = null;
			audioId = new FsmString{UseVariable = true};
			audioDelay = new FsmFloat{UseVariable = true};
			loadLanguageAudio = false;
			audioFinishedEvent = null;
			volume = null;
			color = new FsmColor{UseVariable = true};
			stopAudioOnFinished = false;
			greaterThanFinish = new FsmFloat{UseVariable = true};
				
			fadeIn = new FsmFloat{UseVariable = true};
			fadeOut = new FsmFloat{UseVariable = true};
			fadeAudioIn = false;
			fadeAudioOut = false;	
			waitForAudioFinish = false;
			mouseExit = false;
			rayDistance = 100f;
			layerMask = new FsmInt[0];
			invertMask = false;
			corner = SpeechBubble.CornerEnum.Default;
			
			everyFrame = false;
		}
Exemple #8
0
        private Vector2 GetbubblePosition(Vector2 bubbleSize, PlacementEnum aPlacement)
        {
            if (aPlacement == PlacementEnum.Default)
            {
                aPlacement = (PlacementEnum)_placement;
            }
            //Top Left Position = tlp
            Vector3 pos = new Vector3();
            Vector2 tlp = new Vector2();

            switch (aPlacement)
            {
            case PlacementEnum.Center:
                //Debug.Log(Camera.main);
                //Debug.Log(go);
                //Debug.Log("____");
                pos    = Camera.main.WorldToScreenPoint(go.transform.position);
                tlp.x  = pos.x;
                tlp.y  = Camera.main.pixelHeight - pos.y;
                tlp.x -= bubbleSize.x / 2;
                tlp.y -= bubbleSize.y / 2;
                break;

            case PlacementEnum.TopCenter:
                pos    = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x + bubbleOffsetVector.x, go.transform.position.y + bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
                tlp.x  = pos.x;
                tlp.y  = Camera.main.pixelHeight - pos.y;
                tlp.x -= bubbleSize.x / 2;
                tlp.y -= bubbleSize.y;
                break;

            case PlacementEnum.TopLeft:
                pos    = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x - bubbleOffset + bubbleOffsetVector.x, go.transform.position.y + bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
                tlp.x  = pos.x;
                tlp.y  = Camera.main.pixelHeight - pos.y;
                tlp.x -= bubbleSize.x;
                tlp.y -= bubbleSize.y;
                break;

            case PlacementEnum.TopRight:
                pos    = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x + bubbleOffset + bubbleOffsetVector.x, go.transform.position.y + bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
                tlp.x  = pos.x;
                tlp.y  = Camera.main.pixelHeight - pos.y;
                tlp.y -= bubbleSize.y;
                break;

            case PlacementEnum.BottomCenter:
                pos    = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x + bubbleOffsetVector.x, go.transform.position.y - bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
                tlp.x  = pos.x;
                tlp.y  = Camera.main.pixelHeight - pos.y;
                tlp.x -= bubbleSize.x / 2;
                break;

            case PlacementEnum.BottomLeft:
                pos    = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x - bubbleOffset + bubbleOffsetVector.x, go.transform.position.y - bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
                tlp.x  = pos.x;
                tlp.y  = Camera.main.pixelHeight - pos.y;
                tlp.x -= bubbleSize.x;
                break;

            case PlacementEnum.BottomRight:
                pos   = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x + bubbleOffset + bubbleOffsetVector.x, go.transform.position.y - bubbleOffset + bubbleOffsetVector.y, go.transform.position.z));
                tlp.x = pos.x;
                tlp.y = Camera.main.pixelHeight - pos.y;
                break;

            case PlacementEnum.RightCenter:
                pos    = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x + bubbleOffset + bubbleOffsetVector.x, go.transform.position.y + bubbleOffsetVector.y, go.transform.position.z));
                tlp.x  = pos.x;
                tlp.y  = Camera.main.pixelHeight - pos.y;
                tlp.y -= bubbleSize.y / 2;
                break;

            case PlacementEnum.LeftCenter:
                pos    = Camera.main.WorldToScreenPoint(new Vector3(go.transform.position.x - bubbleOffset + bubbleOffsetVector.x, go.transform.position.y + bubbleOffsetVector.y, go.transform.position.z));
                tlp.x  = pos.x;
                tlp.y  = Camera.main.pixelHeight - pos.y;
                tlp.x -= bubbleSize.x;
                tlp.y -= bubbleSize.y / 2;
                break;
            }
            return(tlp);
        }
Exemple #9
0
        public override void Reset()
        {
            recordingNextEvent = null;
            recordingPrevEvent = null;

            style = new FsmString {
                UseVariable = true
            };
            placement = PlacementEnum.Default;
            offset    = new FsmFloat {
                UseVariable = true
            };
            dictionary = new FsmString {
                UseVariable = true
            };
            id = new FsmString {
                Value = "0000"
            };
            text = new FsmString {
                UseVariable = true
            };
            time = new FsmFloat {
                UseVariable = true
            };
            delay = new FsmFloat {
                UseVariable = true
            };
            finishedEvent = null;
            default_x     = new FsmFloat {
                UseVariable = true
            };
            default_y = new FsmFloat {
                UseVariable = true
            };
            normalized      = true;
            delayTmp        = 0f;
            timeTmp         = 0f;
            depth           = null;
            depthTmp        = 0;
            audioGameObject = new FsmGameObject {
                UseVariable = true
            };
            audioClip = null;
            audioId   = new FsmString {
                UseVariable = true
            };
            audioDelay = new FsmFloat {
                UseVariable = true
            };
            loadLanguageAudio  = false;
            audioFinishedEvent = null;
            volume             = null;
            color = new FsmColor {
                UseVariable = true
            };
            stopAudioOnFinished = false;
            greaterThanFinish   = new FsmFloat {
                UseVariable = true
            };

            fadeIn = new FsmFloat {
                UseVariable = true
            };
            fadeOut = new FsmFloat {
                UseVariable = true
            };
            fadeAudioIn        = false;
            fadeAudioOut       = false;
            waitForAudioFinish = false;
            mouseExit          = false;
            rayDistance        = 100f;
            layerMask          = new FsmInt[0];
            invertMask         = false;
            corner             = SpeechBubble.CornerEnum.Default;

            everyFrame = false;
        }
        // Update content, play animation, play sound, display for a while, then automatically hide
        // Callback only used when there are two buttons
        // Might also consider adding a log, especially for errors
        public void Update(StatusEnum status, string text, ActionsEnum action, PlacementEnum placement, ActionCallBack callback = null)
        {
            // Save parameters
            Status   = status;
            Text     = text;
            Action   = action;
            CallBack = callback;

            // Reconfigure timer
            dispatcherTimer.Interval = new TimeSpan(0, 0, 7);

            // Update Content
            StatusLabel.Content = Status.ToString(); // Update status label
            switch (Status)                          // Update status icon
            {
            case StatusEnum.Event:
                // StatusIcon.Source = ...
                break;

            case StatusEnum.TimerEvent:
                // StatusIcon.Source = ...
                break;

            case StatusEnum.Notice:
                // StatusIcon.Source = ...
                dispatcherTimer.Interval = new TimeSpan(0, 0, 2);
                break;

            case StatusEnum.Welcome:
                // StatusIcon.Source = ...
                break;

            case StatusEnum.Error:
                // StatusIcon.Source = ...
                break;

            default:
                break;
            }
            StatusTextBlock.Text = Text; // Update status text
            switch (Action)              // Update buttons
            {
            case ActionsEnum.AcceptCancel:
                LeftButton.Content      = "Accept";
                LeftButton.Visibility   = Visibility.Visible;
                RightButton.Content     = "Cancel";
                RightButton.Visibility  = Visibility.Visible;
                CenterButton.Visibility = Visibility.Hidden;
                break;

            case ActionsEnum.YesNo:
                LeftButton.Content      = "Yes";
                LeftButton.Visibility   = Visibility.Visible;
                RightButton.Content     = "No";
                RightButton.Visibility  = Visibility.Visible;
                CenterButton.Visibility = Visibility.Hidden;
                break;

            case ActionsEnum.Acknowledge:
                LeftButton.Visibility   = Visibility.Hidden;
                RightButton.Visibility  = Visibility.Hidden;
                CenterButton.Content    = "Ackownledge";
                CenterButton.Visibility = Visibility.Visible;
                break;

            case ActionsEnum.None:
                LeftButton.Visibility   = Visibility.Hidden;
                RightButton.Visibility  = Visibility.Hidden;
                CenterButton.Visibility = Visibility.Hidden;
                break;

            default:
                break;
            }

            // Play blink animation
            // ...

            // Play notif souond
            // ...

            // Restart timer
            dispatcherTimer.Stop();
            dispatcherTimer.Start();

            // Set window location
            var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;

            switch (placement)
            {
            case PlacementEnum.UpperRight:
                this.Left = desktopWorkingArea.Right - this.Width - 50;
                this.Top  = 50;
                break;

            case PlacementEnum.LowerRight:
                this.Left = desktopWorkingArea.Right - this.Width - 50;
                this.Top  = desktopWorkingArea.Bottom - this.ActualHeight - 80;
                break;

            default:
                break;
            }

            // Display Contents
            this.Visibility = Visibility.Visible;
        }
Exemple #11
0
        /// <summary>
        /// Parse a line and fill the differents fields
        /// </summary>
        private void ParseLine(string line)
        {
            int i = -1;

            try
            {
                line = line.Trim();
                switch (m_flag)
                {
                case "<Spells>":
                    i = line.IndexOf('=');
                    if (i != -1)
                    {
                        string[] splitted = line.Split('=');
                        i    = Int32.Parse(splitted[1]);
                        line = splitted[0];
                    }
                    BSpell spell = new BSpell(GetSpellIdFromName(line), line);
                    spells.Add(spell, i);
                    SpellsCondition.Add(spell, m_cond);
                    break;

                case "<Targets>":
                    i = line.IndexOf('=');
                    if (i != -1)
                    {
                        string[] splitted = line.Split('=');
                        i    = Int32.Parse(splitted[1]);
                        line = splitted[0];
                    }
                    targets.Add(line, i);
                    TargetsCondition.Add(line, m_cond);
                    break;

                case "<Strategy>":
                    i = line.IndexOf('=');
                    if (i != -1)
                    {
                        string[] splitted = line.Split('=');
                        i    = Int32.Parse(splitted[1]);
                        line = splitted[0];
                    }
                    TacticEnum tactic = (TacticEnum)Enum.Parse(typeof(TacticEnum), line);
                    if (Enum.IsDefined(typeof(TacticEnum), tactic) | tactic.ToString().Contains(","))
                    {
                        strategy.Add(tactic, i);
                    }
                    else
                    {
                        throw new Exception("AI Script : Invalid strategy at line : " + line);
                    }
                    break;

                case "<Position>":
                    PlacementEnum position = (PlacementEnum)Enum.Parse(typeof(PlacementEnum), line);
                    if (Enum.IsDefined(typeof(PlacementEnum), position) | position.ToString().Contains(","))
                    {
                        positions.Add(position);
                    }
                    else
                    {
                        throw new Exception("AI Script : Invalid position at line : " + line);
                    }
                    break;

                case "<Challenges>":
                    ChallengeEnum challenge = (ChallengeEnum)Enum.Parse(typeof(ChallengeEnum), line);
                    if (Enum.IsDefined(typeof(ChallengeEnum), challenge) | challenge.ToString().Contains(","))
                    {
                        challenges.Add(challenge);
                    }
                    else
                    {
                        throw new Exception("AI Script : Invalid challenge at line : " + line);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }