Exemple #1
0
        private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            // Add Property changed so grid cell will be updated while editing action
            if (e.NewValue is ActionDetails)
            {
                ActionDetails AD = (ActionDetails)e.NewValue;

                // Each action return the info and/or a list of values to show AIVs
                if (!string.IsNullOrEmpty(AD.Info))
                {
                    ActionDetailsLabel.Content = AD.Info;
                }
                else
                {
                    ActionDetailsLabel.Visibility = System.Windows.Visibility.Collapsed;
                }

                ObservableList <ActionParamInfo> parlist = AD.GetParamsInfo();
                if (parlist.Count > 0)
                {
                    AIVGrid.ItemsSource      = (IObservableList)parlist;
                    AIVGrid.Columns[0].Width = 60;
                    AIVGrid.Columns[1].Width = new DataGridLength(100, DataGridLengthUnitType.Star);
                }
                else
                {
                    AIVGrid.Visibility = System.Windows.Visibility.Collapsed;
                }
            }
        }
Exemple #2
0
    void Roll()
    {
        roolInProgress = true;
        rerolled--;
        RerollsCounter.text = (rerolled + 1) + "/" + GameController.Instance.TacticRerolls;

        TinyMessengerHub.Instance.Publish <Msg.StartFightRound>(new Msg.StartFightRound(GameController.Instance.player.FightingGladiator._Id));
        TinyMessengerHub.Instance.Publish <Msg.StartFightRound>(new Msg.StartFightRound(GameController.Instance.player.Opponent._Id));

        ListOfSkills.gameObject.DeleteAllChildreen();
        List <ActiveAbility> abilities = GameController.Instance.player.FightingGladiator.AttackQueue;

        int i = 0;

        foreach (ActiveAbility a in abilities)
        {
            ActionDetails c = (ActionDetails)Instantiate(_ActionDetailItem);
            c.SetAbility(a);
            c.transform.SetParent(ListOfSkills.transform, false);


            c.gameObject.SetActive(false);
            StartCoroutine(PopUp(c.gameObject, 0.25f + i * 0.05f, i >= abilities.Count - 1));

            i++;
        }
    }
Exemple #3
0
    public override Transform GetPrevCursorItem(int currentIndex)
    {
        int nextIndex = currentIndex - 1;

        if (nextIndex < 0)
        {
            nextIndex = menuChoices.Length - 1;
        }
        Transform prevMenuChoice = menuChoices[nextIndex];

        if (nextIndex == 0)
        {
            if (potion.description != "")
            {
                ActionDetails.ActionDescription(potion.description);
            }
        }
        else
        {
            if (ether.description != "")
            {
                ActionDetails.ActionDescription(ether.description);
            }
        }
        return(prevMenuChoice);
    }
Exemple #4
0
 public static void ResetState()
 {
     ActionDetails.ResetDetails();
     InputController.staticCharacterPointer.ResetCameraTransform();
     if (instance)
     {
         instance.Invoke("Pop", 1.5f);
     }
 }
Exemple #5
0
        public JsonResult Register(UserViewModel user)
        {
            var res     = new ActionDetails();
            var results = new RegistrationValidation().Validate(user);

            if (!results.IsValid)
            {
                return(new JsonContractResult
                {
                    Data = new ActionDetails
                    {
                        ResponseCode = ResponseCode.ValidationError,
                        Content = Comman.FluantErrorList(results.Errors),
                        Message = "registration is not success",
                        State = false
                    },
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }

            Mapper.CreateMap <UserViewModel, UserBo>();
            var response = userService.RegisterUser(Mapper.Map <UserBo>(user));

            Enums.AuthType auth = Enums.AuthType.Anonymas;
            if (response.ResponseCode == ResponseCode.Success)
            {
                Mapper.CreateMap <UserBo, SessionModel>();
                SessionConfig.Session = Mapper.Map <SessionModel>((UserBo)response.Content);
                res = new ActionDetails
                {
                    ResponseCode = ResponseCode.Success,
                    Content      = SessionConfig.Session,
                    Message      = "registration is success",
                    State        = true
                };
            }
            else
            {
                res = new ActionDetails
                {
                    ResponseCode = response.ResponseCode,
                    Content      = new List <string> {
                        "user deferent domain"
                    },
                    Message = "registration is not success",
                    State   = false
                };
            }
            return(new JsonContractResult
            {
                Data = res,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemple #6
0
 public override void UseAction(Character target, Character caster)
 {
     // InputController.staticCharacterPointer.SetTarget(target);
     this.caster       = caster;
     this.target       = target;
     damageDealt       = GetDamage();
     targetIsDestroyed = false;
     target.HealMana(damageDealt);
     caster.AnimateCharacter(Character.CharacterPoses.Attacking);
     Invoke("AnimateAction", 0.6f); ActionDetails.ItemDisplayDetails(caster, target, this);
 }
        private static Attachment SetSubmitAction(Attachment card, ActionDetails action)
        {
            var campaign     = card.Content as AdaptiveCard;
            var submitAction = campaign.Actions.FirstOrDefault();

            if (submitAction != null && submitAction.Title == "✔️ Preview")// TODO: change this
            {
                var acknowledgeAction = submitAction as AdaptiveSubmitAction;
                acknowledgeAction.Data = action;
            }
            return(card);
        }
Exemple #8
0
    public override void UseAction(Character target, Character caster)
    {
        // InputController.staticCharacterPointer.SetTarget(target);
        this.caster       = caster;
        this.target       = target;
        targetIsDestroyed = false;

        damageDealt = GetDamage();
        damageDealt = (uint)(damageDealt * (1f / target.GetDefenseMultiplier()));
        ActionDetails.AttackDisplayDetails(caster, target);
        AnimateAction();
    }
Exemple #9
0
    public override Transform GetNextCursorItem(int currentIndex)
    {
        int       nextIndex      = (currentIndex + 1) % menuChoices.Length;
        Transform nextMenuChoice = menuChoices[nextIndex];

        if (nextIndex == (int)MenuOptions.Defend)
        {
            ActionDetails.ActionDescription(inputController.playerInfo.owner.defendAction.description);
        }
        else
        {
            ActionDetails.ResetDetails();
        }
        return(nextMenuChoice);
    }
Exemple #10
0
 public USDControl()
 {
     InitializeComponent();
     hostedCotrolDetailsControl = new HostedControlDetails()
     {
         Dock = DockStyle.Fill
     };
     eventDetailsControl = new EventDetails()
     {
         Dock = DockStyle.Fill
     };
     actionDetailsControl = new ActionDetails()
     {
         Dock = DockStyle.Fill
     };
 }
Exemple #11
0
 void Update()
 {
     if (IsPointingAtCharacters())
     {
         if (Input.GetKeyDown(KeyCode.LeftArrow))
         {
             characterPointer.AdvancePointerBackward();
         }
         else if (Input.GetKeyDown(KeyCode.RightArrow))
         {
             characterPointer.AdvancePointerForward();
         }
         else if (Input.GetKeyDown(KeyCode.Return))
         {
             // Select target
             activeMenu.RunMenuOption(cursor.GetCursorIndex(), characterPointer.GetTarget());
             characterPointer.DisablePointer();
             characterPointer.ResetCameraTransform();
         }
         else if (Input.GetKeyDown(KeyCode.Escape))
         {
             // Return to normal UI
             characterPointer.DisablePointer();
             characterPointer.ResetCameraTransform();
             ActionDetails.ResetDetails();
         }
     }
     else if (activeMenu != null)
     {
         if (Input.GetKeyDown(KeyCode.DownArrow))
         {
             IncrementCursor();
         }
         else if (Input.GetKeyDown(KeyCode.UpArrow))
         {
             DecrementCursor();
         }
         else if (Input.GetKeyDown(KeyCode.Return))
         {
             SelectMenuItem();
         }
         else if (Input.GetKeyDown(KeyCode.LeftArrow))
         {
             ReturnToBaseMenu();
         }
     }
 }
Exemple #12
0
        public static void CaptureBefore(Player player, ActionDetails details)
        {
            var data = GetData(player);

            lock (data)
            {
                // capture the angle to the center
                data.CenterAngle = details.AngleToCenter;

                // capture the user health, shield, weapon status, inzone, Z
                data.Angle  = player.Angle;
                data.Health = player.Health;
                data.InZone = details.InZone;
                data.Xdelta = details.XDelta;
                data.Ydelta = details.YDelta;
                if (player.Primary != null && player.Primary is RangeWeapon)
                {
                    data.Primary     = player.Primary.GetType().Name;
                    data.PrimaryAmmo = (player.Primary as RangeWeapon).Ammo;
                    data.PrimaryClip = (player.Primary as RangeWeapon).Clip;
                }
                else
                {
                    data.Primary     = "";
                    data.PrimaryAmmo = data.PrimaryClip = 0;
                }
                if (player.Secondary != null && player.Secondary.Length == 1 && player.Secondary[0] != null && player.Secondary[0] is RangeWeapon)
                {
                    data.Secondary     = player.Secondary.GetType().Name;
                    data.SecondaryAmmo = (player.Secondary[0] as RangeWeapon).Ammo;
                    data.SecondaryClip = (player.Secondary[0] as RangeWeapon).Clip;
                }
                else
                {
                    data.Secondary     = "";
                    data.SecondaryAmmo = data.SecondaryClip = 0;
                }
                data.Shield = player.Shield;
                data.Z      = player.Z;

                // capture what the user sees
                data.Proximity = AITraining.ComputeProximity(player, details.Elements).Values.ToList();
            }
        }
Exemple #13
0
    public override Transform GetPrevCursorItem(int currentIndex)
    {
        int nextIndex = currentIndex - 1;

        if (nextIndex < 0)
        {
            nextIndex = menuChoices.Length - 1;
        }
        Transform prevMenuChoice = menuChoices[nextIndex];

        if (nextIndex == (int)MenuOptions.Defend)
        {
            ActionDetails.ActionDescription(inputController.playerInfo.owner.defendAction.description);
        }
        else
        {
            ActionDetails.ResetDetails();
        }
        return(prevMenuChoice);
    }
Exemple #14
0
    public void FillWithGladiatorDetails(Gladiator g)
    {
        name.text       = g.Name;
        level.text      = "LVL: " + g.Level;
        adrenaline.text = "ADR: " + g.BaseAdrenaline;
        health.text     = "HP: " + g.BaseLife;

        List <GameObject> children = new List <GameObject>();

        foreach (Transform child in AvatarContainer.transform)
        {
            children.Add(child.gameObject);
        }
        children.ForEach(child => Destroy(child));

        GameObject o = (GameObject)Instantiate(GameController.Instance.GetPrefabForGladiator(g));

        o.transform.SetParent(AvatarContainer.transform, false);
        RectTransform r = o.GetComponent <RectTransform>();

        o.transform.localPosition = new Vector3(-28, -32, 0);

        SkillsList.gameObject.DeleteAllChildreen();
        #region Loading Passive abilities list
        foreach (PassiveAbility p in g.PassiveAbilities)
        {
            ActionDetails c = (ActionDetails)Instantiate(_ActionDetailItem);
            c.SetAbility(p);
            c.transform.SetParent(SkillsList.transform, false);
        }
        #endregion

        #region Loading Active abilities list
        foreach (ActiveAbility ac in g.ActiveAbilities)
        {
            ActionDetails c = (ActionDetails)Instantiate(_ActionDetailItem);
            c.SetAbility(ac);
            c.transform.SetParent(SkillsList.transform, false);
        }
        #endregion
    }
Exemple #15
0
    public override Transform GetNextCursorItem(int currentIndex)
    {
        int       nextIndex      = (currentIndex + 1) % menuChoices.Length;
        Transform nextMenuChoice = menuChoices[nextIndex];

        if (nextIndex == 0)
        {
            if (potion.description != "")
            {
                ActionDetails.ActionDescription(potion.description);
            }
        }
        else
        {
            if (ether.description != "")
            {
                ActionDetails.ActionDescription(ether.description);
            }
        }
        return(nextMenuChoice);
    }
Exemple #16
0
    void Pop()
    {
        foreach (Character c in charactersToDelete)
        {
            RemoveCharacter(c);
        }
        charactersToDelete.Clear();

        if (queue.Count > 0)
        {
            if (players.Count == 0)
            {
                ActionDetails.GameOverDisplayDetails();
                StartCoroutine(AnimateCreditsIn());
                // Fade out
                return;
            }
            if (enemies.Count == 0)
            {
                ActionDetails.VictoryDisplayDetails();
                StartCoroutine(AnimateCreditsIn());
                foreach (Player p in players)
                {
                    p.AnimateCharacter(Character.CharacterPoses.Victory);
                }

                return;
            }

            Character activeCharacter = queue.Dequeue();
            while (activeCharacter == null)
            {
                activeCharacter = queue.Dequeue();
            }
            queue.Enqueue(activeCharacter);
            activeCharacter.StartTurn();
        }
    }
    public HttpResponseMessage DoSomeAction(ActionDetails details)
    {
        // prepare the result content
        string jsonResult = "{}";

        switch (details.action)
        {
        case "getExternalServicePar":
            var action1Result = GetFromSomewhere(details.args.id);         // do something
            jsonResult = Newtonsoft.Json.JsonConvert.SerializeObject(action1Result);
            break;

        case "incrementVallet":
            var action2Result = ...;         // do something else
            jsonResult = Newtonsoft.Json.JsonConvert.SerializeObject(action2Result);
            break;
        }
        // put the serialized object into the response (and hope the client knows what to do with it)
        var response = this.Request.CreateResponse(HttpStatusCode.OK);

        response.Content = new StringContent(jsonResult, Encoding.UTF8, "application/json");
        return(response);
    }
Exemple #18
0
        public JsonResult Authonticate(UserViewModel user)
        {
            var res = new ActionDetails();

            Mapper.CreateMap <UserViewModel, UserBo>();
            var response = userService.Authenticate(Mapper.Map <UserBo>(user));

            Enums.AuthType auth = Enums.AuthType.Anonymas;
            if (response.ResponseCode == App.Utilities.ResponseCode.Success)
            {
                Mapper.CreateMap <UserBo, SessionModel>();
                var repo = Mapper.Map <SessionModel>((UserBo)response.Content);
                SessionConfig.Session = repo;
                auth = repo.EmailConfirmed ? Enums.AuthType.ValidateEmail : Enums.AuthType.NotValidateEmail;
                res  = new ActionDetails
                {
                    ResponseCode = ResponseCode.Success,
                    Content      = SessionConfig.Session,
                    Message      = "login is success",
                    State        = true
                };
            }
            else
            {
                res = new ActionDetails
                {
                    ResponseCode = ResponseCode.ValidationError,
                    Message      = "login is not success",
                    State        = false
                };
            }
            return(new JsonContractResult
            {
                Data = res,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemple #19
0
 public override void UseAction(Character target, Character caster)
 {
     base.UseAction(target, caster);
     ActionDetails.DefendDisplayDetails(caster);
 }
Exemple #20
0
        /// <summary>
        /// Tests loading of a 3rd party unsigned action with a dependency on an unmanaged dll. 
        /// Verifies that all the action ifaces are loaded from the correct location and that the unmanaged dll
        /// is loaded from the correct location.
        /// </summary>
       // [Test]
        public void LoadUnsignedActionFromLocation()
        {
			if (Marshal.SizeOf(typeof(IntPtr)) == 8)
				throw new IgnoreException("can't run this test easily on 64 bit without recompiling the action and adding its references and a whole bunch of related stuff");

            #region setup
            ActionDetails ad = new ActionDetails("3rd Party",
                Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\projects\Hygiene\src\PolicyEngine.Tests\TestFiles\UnsignedAction"),
                "Typical3rdPartyAction.dll",
                "Workshare\\ProtectEnterprise\\Actions",
                "Typical3rdPartyAction",
                "f2c04c19-54fb-48f6-af3d-82c9404deaf2");

            string managedDll = "unmanageddll.dll";
            string managedDllLocation = Path.Combine(Path.GetDirectoryName(ad.Path), managedDll);
            string targetDllLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, managedDll);

            //attempt to copy the managed dll to the basedirectory of current appdomain so its in 2 locations
            System.IO.File.Copy(managedDllLocation,targetDllLocation, true);
            //add temp file to the deletion list
            m_TempFiles.Add(targetDllLocation);

            RegistryTree rt = new RegistryTree(ad.HKLMRegLocation, ad.AssemblyName, ad.Path);
            string rulesXML = System.IO.File.ReadAllText(Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\projects\Hygiene\src\PolicyEngine.Tests\TestFiles\SignedPartyAction\rules.xml"));
            string objectsXML = System.IO.File.ReadAllText(Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\projects\Hygiene\src\PolicyEngine.Tests\TestFiles\SignedPartyAction\objects.xml"));
            GeneralPolicyProcessor gpp = new GeneralPolicyProcessor();
            //start following parameters have no bearing on this test case but need to be filled in for the gpp to run
            gpp.FileType = "*.email";
            gpp.CurrentUser = "******";
            gpp.CurrentRunAtMode = RunAt.Client;
            gpp.RecipientList = new string[] { "*****@*****.**" };
            //end irrelevant parameters
            gpp.Initialise(RunAt.Client, rulesXML, objectsXML);
            Chilkat.Cert cert = new Chilkat.Cert();
            #endregion

            string assemblyName, className;
            CachedAction action = gpp.LoadActionObject(ad.ObjectRef, ad.Name, out assemblyName, out className);

            Assert.IsNotNull(action, "No {0} action found", ad.Name);
            VerifyObjectLocation(action.Action, ad);
            //verify location of unmanaged dll - cause unmanaged dll is latebound we need to invoke to make sure it gets loaded first
            ActionPropertySet adata = action.Action.PropertySet;
            ActionData testData = new ActionData();
   			testData.FileName = Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\projects\Hygiene\src\PolicyEngine.Tests\TestFiles\TestfileActionLoad.txt");
			testData.Properties.Add("DisplayName", Path.GetFileName(testData.FileName));	
            action.Action.Execute(testData, adata);
            // testdll.dll should be loaded now
            bool found = false;
            foreach (ProcessModule pm in Process.GetCurrentProcess().Modules)
            {
                if (pm.ModuleName.Equals(managedDll, StringComparison.InvariantCultureIgnoreCase))
                {
                    found = true;
                    Assert.IsTrue(string.Equals(managedDllLocation, pm.FileName, StringComparison.InvariantCultureIgnoreCase),
                        "{0} loaded from incorrect location, expected {1}, actual {2}", managedDll, managedDllLocation, pm.FileName);
                }
            }
            Assert.IsTrue(found, "unmanaged dll {0} not found in current process' modules", managedDll);
        }
Exemple #21
0
 void VerifyObjectLocation(object o, ActionDetails expected)
 {
     Assert.IsTrue(o.GetType().Assembly.FullName.StartsWith(expected.AssemblyNameSansExt),
        "Action assembly incorrect!!, expecting {0} but is {1}", expected.AssemblyNameSansExt, o.GetType().Assembly.FullName);
     AppDomain currentDomain = AppDomain.CurrentDomain;
     int numberOfTimesFound = 0;
     foreach (Assembly a in currentDomain.GetAssemblies())
     {
         if (a.FullName.StartsWith(expected.AssemblyNameSansExt))
         {
             numberOfTimesFound++;
             //verify image location
             Assert.AreEqual(expected.Path, a.Location, "assembly loaded from incorrect location");
         }
     }
     Assert.AreEqual(1, numberOfTimesFound, "Assembly not found or loaded multiple times ??");
 }
Exemple #22
0
        /// <summary>
        /// Tests loading of a workshare signed action with no unmanaged dependencies.
        /// This test relies on an example action precompiled and committed to source control as
        /// test data : this AbortOnExecute action can be found in the PESAction solution. 
        /// </summary>
       // [Test]
        public void LoadSignedActionFromLocation()
        {
            ActionDetails ad = new ActionDetails("Abort",
                 Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\projects\Hygiene\src\PolicyEngine.Tests\TestFiles\SignedPartyAction"),
                "Workshare.Policy.Actions.AbortOnExecuteAction.dll",
                "Workshare\\ProtectEnterprise\\Actions",
                "Workshare.Policy.Actions.AbortOnExecuteAction",
                "f2099407-96c1-4e5d-8b6a-ed5163b41fd4");

            System.IO.File.Move(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ad.AssemblyName),
                Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ad.AssemblyName + ".tmp"));
            try
            {
                #region setup
                RegistryTree rt = new RegistryTree(ad.HKLMRegLocation, ad.AssemblyName, ad.Path);
                //now comes the ugly bit of the setup
                //rules and object file below retrieved from a policy created with PolicyDesigner and copy/pasted from the
                //policy explorer
                string rulesXML = System.IO.File.ReadAllText(Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\projects\Hygiene\src\PolicyEngine.Tests\TestFiles\SignedPartyAction\rules.xml"));
                string objectsXML = System.IO.File.ReadAllText(Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\projects\Hygiene\src\PolicyEngine.Tests\TestFiles\SignedPartyAction\objects.xml"));
                GeneralPolicyProcessor gpp = new GeneralPolicyProcessor();
                //start following parameters have no bearing on this test case but need to be filled in for the gpp to run
                gpp.FileType = "*.email";
                gpp.CurrentUser = "******";
                gpp.CurrentRunAtMode = RunAt.Client;
                gpp.RecipientList = new string[] { "*****@*****.**" };
                //end irrelevant parameters
                gpp.Initialise(RunAt.Client, rulesXML, objectsXML);

            #endregion

                string assemblyName, className;

                //execute
                //parameters must match what is setup in the object and rules file
                CachedAction action = gpp.LoadActionObject(ad.ObjectRef, ad.Name, out assemblyName, out className);

                //verify

                Assert.IsNotNull(action, "No {0} action found", ad.Name);
                VerifyObjectLocation(action.Action, ad);
            }
            finally
            {
                System.IO.File.Move(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ad.AssemblyName + ".tmp"),
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ad.AssemblyName));
            }
        }
Exemple #23
0
 public override void UseAction(Character target, Character caster)
 {
     base.UseAction(target, caster);
     ActionDetails.MagicDisplayDetails(caster, target, this);
 }
Exemple #24
0
 public void SetTarget(Character newTarget)
 {
     ActionDetails.TargetDisplayDetails(newTarget);
     MoveToCharacter(newTarget);
     target = newTarget;
 }
Exemple #25
0
    public ErrCode SaveAction(ActionDetails ad, out int id)
    {
        ErrCode err = SiteProvider.CurrentProvider.SaveAction(ad, out id);

        return err;
    }
        public bool OnAttachAsSub(Character target)
        {
            attachType = ModifierAttachType.Sub;
            bool attachSuccess = false;

            try {
                Modifier           highest     = target.FindModifierOfHighestRank();
                MType              highestType = (MType)(int)highest.Type();
                MType              thisType    = (MType)(int)Type();
                List <Interaction> inters      = modifierInteractionCollection.Find(highestType, thisType);
                if (inters.Count < 1)
                {
                    return(attachSuccess);
                }

                Interaction       inter = inters[0];
                bool              isStateQuerySuccess = false;
                MainModifierState mainState           = MainModifierState.Ground;
                if (highest is BaseModifier)
                {
                    bool justChanged;
                    isStateQuerySuccess = ((BaseModifier)highest).TryQueryingState(out mainState, out justChanged);
                }

                if (!isStateQuerySuccess)
                {
                    mainState = target.IsOnGround()
                                                ? MainModifierState.Ground
                                                : MainModifierState.Air;
                }

                List <ActionDetails> actions = inter.FindActions(mainState);
                if (actions.Count < 1)
                {
                    return(attachSuccess);
                }

                for (int i = 0; i < actions.Count; i++)
                {
                    ActionDetails ad = actions[i];
                    switch (ad.ShowActionType())
                    {
                    case InteractionActionType.DoNothing:
                        attachSuccess = false;
                        break;

                    case InteractionActionType.Vibrate:
                        VibrateActionDetails vad = (VibrateActionDetails)ad;
                        VibrateTarget(
                            vad.xAmplitude, vad.duration, vad.frequency, vad.shouldDecay,
                            vad.decayConstant, targetGameObject, () => subLifetime.End()
                            );
                        attachSuccess = true;
                        break;

                    case InteractionActionType.PlayAnimation:
                        PlayAnimationActionDetails paad = (PlayAnimationActionDetails)ad;
                        if (targetAnimation.CurrentAnimationNames().Contains(paad.name))
                        {
                            targetAnimation.Stop();
                        }

                        targetAnimation.PlayAnimation(paad.name);
                        targetAnimation.JumpToFrame(paad.startFrame);
                        if (highest is StunModifier)
                        {
                            ((StunModifier)highest).OnAnimationPlayedBySubModifier(paad.name);
                        }
                        subLifetime.End();
                        attachSuccess = true;
                        break;

                    case InteractionActionType.Jump:
                        JumpActionDetails jad = (JumpActionDetails)ad;
                        movingJumpRequest = new MovingJumpRequest(
                            jad.height, jad.timeToPeak, jad.timeToGround, jad.timeToFloat, jad.distance
                            );
                        targetEntity.GetComponent <MovementComponent>().AddMovementRequest(
                            movingJumpRequest
                            );
                        attachSuccess = true;
                        break;

                    case InteractionActionType.Dash:
                        MovementComponent casterMc     = casterEntity.GetComponent <MovementComponent>();
                        Direction         casterFacing = casterMc.FacingDirection;
                        DashActionDetails dad          = (DashActionDetails)ad;
                        dashRequest = new DashRequest(
                            casterFacing, dad.distance, dad.duration, 0, dad.constantSpeed
                            );
                        targetEntity.GetComponent <MovementComponent>().AddMovementRequest(
                            dashRequest
                            );
                        attachSuccess = true;
                        break;

                    case InteractionActionType.OverrideMainModifier:
                        attachType = ModifierAttachType.Main;
                        target.RemoveModifier(highest);
                        OnAttachAsMain(target);
                        attachSuccess = true;
                        break;

                    case InteractionActionType.IncreaseLyingDuration:
                        StunInfo si = (StunInfo)info;
                        increaseLyingDuration = new IncreaseLyingDuration(
                            subLifetime, si.ShowDuration(), targetEntity
                            );
                        attachSuccess = true;
                        break;

                    default:
                        throw new Exception(
                                  "Missing logic to handle SubModifier of ActionType " + ad.ShowActionType()
                                  );
                    }
                }

                return(attachSuccess);
            }
            catch (Exception e) {
                DLog.LogError(e);
                return(attachSuccess);
            }
        }
    void Start()
    {
        if (GameController.Instance.player == null)
        {
            return;
        }

        GameController.Instance.player.NumberOfVictories++;

        #region Creating Gladiator
        Gladiator           g = GameController.Instance.player.Opponent;
        GladiatorController c = Instantiate(GameController.Instance.GetPrefabForGladiator(g)).GetComponent <GladiatorController>();
        c.gameObject.transform.position = new Vector3(0, 40, 0);
        c.Id = g._Id;
        if (g._Id == GameController.Instance.player.Opponent._Id)
        {
            c.gameObject.transform.localScale = new Vector3(-1, 1, 1);
        }
        c.transform.SetParent(LooserContainer.transform, false);
        c.SwitchState(GladiatorController.AnimationState.Kneeling);
        #endregion

        FreeSlot.text = "";
        if (GameController.Instance.player.CanAddToParty())
        {
            FreeSlot.gameObject.SetActive(false);
        }
        else
        {
            FreeSlot.gameObject.SetActive(true);
            FreeSlot.text = "You don't have free slots in your party to fit new gladiator";
        }
        abilityLimitReached = false;
        if (GameController.Instance.player.FightingGladiator.PassiveAbilities.Count + GameController.Instance.player.FightingGladiator.ActiveAbilities.Count >=
            GameController.Instance.MaxAbilitiesPerGladiator)
        {
            FreeSlot.gameObject.SetActive(true);
            abilityLimitReached = true;
            FreeSlot.text      += "\nAbility limit reached: " + GameController.Instance.MaxAbilitiesPerGladiator;
        }

        _SelectedAbility = 0;

        #region Loading Opponent skill list
        _LooserList = new List <Ability>();
        foreach (PassiveAbility p in GameController.Instance.player.Opponent.PassiveAbilities)
        {
            _LooserList.Add(p);
        }
        foreach (ActiveAbility a in GameController.Instance.player.Opponent.ActiveAbilities)
        {
            _LooserList.Add(a);
        }
        //removing passive abilities that player already posses
        foreach (PassiveAbility p in GameController.Instance.player.FightingGladiator.PassiveAbilities)
        {
            if (_LooserList.Contains(p))
            {
                _LooserList.Remove(p);
            }
        }

        foreach (Ability p in _LooserList)
        {
            ActionDetails action = Instantiate(ActionDetailsPrefab);
            action.transform.SetParent(LooserSkillsList.transform, false);
            action.SetAbility(p);
        }
        #endregion

        TinyMessengerHub.Instance.Publish <Msg.HideArrowKeys>(new Msg.HideArrowKeys(true));
        StartCoroutine(DecideFait());
    }
Exemple #28
0
    // Use this for initialization
    void Start()
    {
        TinyTokenManager.Instance.Register <Msg.UpgradeFinished>("LEVEL_UP" + GetInstanceID() + "FIN", (m) => {
            TinyTokenManager.Instance.Unregister <Msg.UpgradeFinished>("LEVEL_UP" + GetInstanceID() + "FIN");

            Destroy(oldGC.gameObject);

            if (levelProgress)
            {
                GameController.Instance.player.FightingGladiator.Level++;

                Gladiator g2          = GameController.Instance.player.FightingGladiator;
                GladiatorController c = Instantiate(GameController.Instance.GetPrefabForGladiator(g2)).GetComponent <GladiatorController>();
                c.Id = g2._Id;
                c.gameObject.transform.position = new Vector3(0, 110, 0);

                c.transform.SetParent(CharacterHolder.transform, false);
                c.SwitchState(GladiatorController.AnimationState.Idle);
            }

            TinyMessengerHub.Instance.Publish <Msg.HideArrowKeys>(new Msg.HideArrowKeys(false));
            TinyTokenManager.Instance.Register <Msg.SelectPerformed>("LEVEL_UP" + GetInstanceID() + "SELECT", (msg) => {
                Unregister();
                StartCoroutine(Finish());
            });
        });

        if (GameController.Instance.player.FightingGladiator.LastLevelUpedAbility.Level > GameController.Instance.player.FightingGladiator.Level)
        {
            levelProgress = true;
        }

        #region Creating Gladiator
        Gladiator g = GameController.Instance.player.FightingGladiator;
        oldGC = Instantiate(GameController.Instance.GetPrefabForGladiator(g)).GetComponent <GladiatorController>();
        oldGC.gameObject.transform.position = new Vector3(0, 110, 0);
        oldGC.Id = g._Id;

        oldGC.transform.SetParent(CharacterHolder.transform, false);
        if (levelProgress)
        {
            oldGC.SwitchState(GladiatorController.AnimationState.Upgrade);
        }
        else
        {
            oldGC.SwitchState(GladiatorController.AnimationState.Idle);
        }
        #endregion

        ActionDetails ab = (ActionDetails)Instantiate(_AbilityHolder);
        ab.transform.SetParent(NewSKill.transform, false);
        ab.SetAbility(GameController.Instance.player.FightingGladiator.LastLevelUpedAbility);

        foreach (ActiveAbility a in GameController.Instance.player.FightingGladiator.EvolvedAbilities)
        {
            ActionDetails abb = (ActionDetails)Instantiate(_AbilityHolder);
            abb.transform.SetParent(OldSkills.transform, false);
            abb.SetAbility(a);
        }

        GameController.Instance.player.FightingGladiator.LastLevelUpedAbility = null;

        TinyMessengerHub.Instance.Publish <Msg.HideArrowKeys>(new Msg.HideArrowKeys(true));

        if (!levelProgress)
        {
            TinyMessengerHub.Instance.Publish <Msg.UpgradeFinished>(new Msg.UpgradeFinished());
        }
    }