コード例 #1
0
ファイル: SegmentIO.cs プロジェクト: alexed1/dtrack
 public void Identify(UserDO userDO)
 {
     var props = new Traits();
     foreach (var prop in GetProperties(userDO))
         props.Add(prop.Key, prop.Value);
     
     Analytics.Client.Identify(userDO.Id, props);
 }
コード例 #2
0
ファイル: Identify.cs プロジェクト: thisdata/Analytics.NET
        internal Identify(string userId,
		                  Traits traits, 
						  Options options)
	
			: base("identify", userId, options)
        {
            this.Traits = traits ?? new Traits();
        }
コード例 #3
0
        internal Identify(string userId,
		                  Traits traits, 
						  Options options)
	
			: base("identify", options)
        {
			UserId = userId;
            Traits = traits ?? new Traits();
        }
コード例 #4
0
ファイル: Group.cs プロジェクト: PlayFab/Analytics.NET
 internal Group(string userId,
     string groupId,
     Traits traits,
     Options options)
     : base("group", userId, options)
 {
     this.GroupId = groupId;
     this.Traits = traits ?? new Traits();
 }
コード例 #5
0
ファイル: Group.cs プロジェクト: detroitpro/Analytics.Xamarin
		internal Group(string userId, 
					   string groupId,
					   Traits traits, 
					   Options options)
			: base("group", options)
        {
			UserId = userId;
			GroupId = groupId;
			Traits = traits ?? new Traits();
        }
コード例 #6
0
 public static Traits MapNewApplicationNoGuarantor(Customer tenant, string applicationReference, string shortURl)
 {
     var traits = new Traits
     {
         {"email", tenant.Email},
         {"tenantMobileNumber", tenant.TelephoneNumber },
         {"hasGuarantor", "false"},
         {"applicationReference", applicationReference},
         {"tenantFirstName", tenant.KnownAs}
     };
     return traits;
 }
コード例 #7
0
 public void ChangeTrait(Traits _trait)
 {
     this.trait = _trait;
 }
コード例 #8
0
                public static Traits operator +(Traits a, Traits b)
                {
                    Traits r = new Traits();

                    r.str = a.str + b.str;
                    r.dex = a.dex + b.dex;
                    r.intel = a.intel + b.intel;
                    r.wis = a.wis + b.wis;
                    r.spd = a.spd + b.spd;
                    r.con = a.con + b.con;

                    return r;
                }
コード例 #9
0
        protected string SetTraits(SimDescription me, IEnumerable <SimTrait.Item> choices)
        {
            string result = Name + Common.NewLine + me.FullName;

            bool success = false;

            foreach (SimTrait.Item selection in choices)
            {
                if (me.TraitManager.HasElement(selection.Value))
                {
                    continue;
                }

                Trait selected = TraitManager.GetTraitFromDictionary(selection.Value);
                if (selected != null)
                {
                    if (!selected.TraitValidForAgeSpecies(CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(CASAgeGenderFlags.Adult | me.Species)))
                    {
                        continue;
                    }

                    if (me.mSpendableHappiness < selected.Score)
                    {
                        continue;
                    }

                    me.mSpendableHappiness -= selected.Score;

                    result += Common.NewLine + "  " + selected.TraitName(me.IsFemale);

                    success = true;

                    if (Traits.IsObjectBaseReward(selected.Guid))
                    {
                        if (me.Household == null)
                        {
                            continue;
                        }

                        if (me.CreatedSim == null)
                        {
                            continue;
                        }

                        HudModel hudModel = Sims3.UI.Responder.Instance.HudModel as HudModel;
                        if (hudModel != null)
                        {
                            bool showTNS          = SimTypes.IsSelectable(me);
                            bool inHouseInventory = false;
                            Sim  rewardedSim      = me.CreatedSim;
                            hudModel.GiveRewardObjects(me.CreatedSim, selected.Guid, selected.ProductVersion, ref showTNS, ref inHouseInventory, ref rewardedSim);
                        }
                    }
                    else
                    {
                        switch (selected.Guid)
                        {
                        case TraitNames.ForeverYoung:
                            me.AgingEnabled = false;
                            break;

                        default:
                            if (selected.Guid == TraitNames.SuperVampire)
                            {
                                me.AgingEnabled = false;
                            }

                            if (!me.AddTrait(selected))
                            {
                                me.mSpendableHappiness += selected.Score;
                            }
                            break;
                        }
                    }
                }
            }

            if (!success)
            {
                result += Common.NewLine + "  " + Common.Localize(GetTitlePrefix() + ":None");
            }

            return(result);
        }
コード例 #10
0
ファイル: Client.cs プロジェクト: mrDeadLinez/segmentio-unity
 /// <summary>
 /// Identifying a visitor ties all of their actions to an ID you
 /// recognize and records visitor traits you can segment by.
 /// </summary>
 ///
 /// <param name="userId">The visitor's identifier after they log in, or you know
 /// who they are. By
 /// explicitly identifying a user, you tie all of their actions to their identity.</param>
 ///
 /// <param name="traits">A dictionary with keys like "email", "name", “subscriptionPlan” or
 /// "friendCount”. You can segment your users by any trait you record.
 /// Pass in values in key-value format. String key, then its value
 /// { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param>
 ///
 /// <param name="timestamp">  If this event happened in the past, the timestamp
 /// can be used to designate when the identification happened. Careful with this one,
 /// if it just happened, leave it null.</param>
 ///
 public void Identify(string userId, Traits traits, DateTime?timestamp)
 {
     Identify(userId, traits, timestamp, null);
 }
コード例 #11
0
        public void DoesNotThrowAndCanGetItem()
        {
            var provider = Traits.CreateProvider(this);

            var fakeParent = CreateFakeParent();
            var result     = provider.CreateItem(ID.NewID, ID.NewID.ToString(), ID.NewID, fakeParent, Traits.CreateCallContext(this));

            Assert.That(result, Is.True);
        }
コード例 #12
0
        public override void CalculateTraits()
        {
            #region policz biale i czarne piksele
            int WhitePixels = 0;
            int BlackPixels = 0;
            int cw1         = 0;
            int cw2         = 0;
            int cw3         = 0;
            int cw4         = 0;

            double u00 = 0;

            for (int i = 0; i < 28; ++i)
            {
                for (int j = 0; j < 28; ++j)
                {
                    if ((i < 14) && (j < 14) && (PixelsBW[i, j] == 1))
                    {
                        cw1++;
                    }
                    if ((i >= 14) && (j < 14) && (PixelsBW[i, j] == 1))
                    {
                        cw2++;
                    }
                    if ((i < 14) && (j >= 14) && (PixelsBW[i, j] == 1))
                    {
                        cw3++;
                    }
                    if ((i >= 14) && (j >= 14) && (PixelsBW[i, j] == 1))
                    {
                        cw4++;
                    }
                    if (PixelsBW[i, j] == 0)
                    {
                        WhitePixels++;
                    }
                    else
                    {
                        BlackPixels++;
                    }

                    u00 += PixelsBW[i, j];
                }
            }

            double u10 = 0;
            double u01 = 0;

            for (int i = 0; i < 28; ++i)
            {
                for (int j = 0; j < 28; ++j)
                {
                    u10 += i * PixelsBW[i, j];
                    u01 += j * PixelsBW[i, j];
                }
            }

            u10 = u10 / u00;
            u01 = u01 / u00;

            double u20 = 0;
            double u02 = 0;
            double u11 = 0;

            for (int i = 0; i < 28; ++i)
            {
                for (int j = 0; j < 28; ++j)
                {
                    u20 += (i - u10) * (i - u10) * PixelsBW[i, j];
                    u02 += (j - u01) * (j - u01) * PixelsBW[i, j];
                    u11 += (i - u10) * (j - u01) * PixelsBW[i, j];
                }
            }

            u20 = u20 / u00;
            u02 = u02 / u00;
            u11 = u11 / u00;

            #endregion

            #region znajdz obszary
            int WhiteGroupsCount = 0;
            int BlackGroupsCount = 0;


            for (int i = 0; i < 28; ++i)
            {
                for (int j = 0; j < 28; ++j)
                {
                    IfAlreadyChecked[i, j] = false;
                }
            }

            for (int i = 0; i < 28; ++i)
            {
                for (int j = 0; j < 28; ++j)
                {
                    if (IfAlreadyChecked[i, j] == false)
                    {
                        FirstInGroup = PixelsBW[i, j];
                        stack.Push(new XY(i, j));
                        while (stack.Count != 0)
                        {
                            XY pixel = stack.Pop();
                            IfAlreadyChecked[pixel.X, pixel.Y] = true;
                            RegionCheckNeighbours(pixel.X, pixel.Y);
                        }
                        if (FirstInGroup == 0)
                        {
                            WhiteGroupsCount++;
                        }
                        else
                        {
                            BlackGroupsCount++;
                        }
                    }
                }
            }

            stack.Clear();
            #endregion

            // 1. ilosc bialych pikseli
            // Traits.Add(WhitePixels);
            // 2. ilosc czarnych piskeli
            //  Traits.Add(BlackPixels);
            // 3. ilosc okienek (H)
            Traits.Add((WhiteGroupsCount - 1) * 10);
            // 4. ilosc czarnych obiektow (C)
            Traits.Add((BlackGroupsCount) * 10);
            // 5. liczba eulera (C-H)
            Traits.Add((BlackGroupsCount - (WhiteGroupsCount - 1)) * 10);
            // 6. stosunek czerni do bieli 1./2.
            //   Traits.Add(WhitePixels / BlackPixels);
            Traits.Add(cw1);
            Traits.Add(cw2);
            Traits.Add(cw3);
            Traits.Add(cw4);
            Traits.Add(u00);
            Traits.Add(u10);
            Traits.Add(u01);
            Traits.Add(u20);
            Traits.Add(u02);
            Traits.Add(u11);
        }
コード例 #13
0
ファイル: TREE.cs プロジェクト: dlobser/beach
    void Awake()
    {
        JCounter = new int[1];
        jointDictionary = new Dictionary<int[],GameObject> ();
        traits = Traits.Instance;
        traits.build ();

        print (defaultJoint);

        if (defaultJoint == null)
            defaultJointExists = false;

        trait = new Trait ();
        trait.makeDefault ();

        //make an invisible root joint
        //		Trait rootTrait = new Trait ();
        //		rootTrait.makeDefault ();
        //		rootTrait.jointMesh = null;
        //		rootTrait.ballMesh = null;
        //		root = TREEUtils.JointFactory (rootTrait);
        //		root.name = "root";
        //		root = makeRoot();
        Joint j = this.gameObject.AddComponent<Joint> ();
        Trait rootTrait = new Trait ();
        rootTrait.makeDefault ();
        rootTrait.jointMesh = null;
        rootTrait.ballMesh = null;
        j.trait = rootTrait;
        this.name = "root";
        root = this.gameObject;
        //		root.transform.parent = transform;
    }
コード例 #14
0
 public List <Trait> GetHouse(int index) => Traits.Skip(index).TakeEvery(5).ToList();
コード例 #15
0
 public Trait GetTrait(Traits pTrait)
 {
     return(_traits[pTrait]);
 }
コード例 #16
0
ファイル: HostCommand.cs プロジェクト: snickroger/Totem
        private void InitializeLog()
        {
            SerilogAdapter = new SerilogAdapter(ReadLogger(), Section.Log.Level);

            Traits.InitializeLog(SerilogAdapter);
        }
コード例 #17
0
        public int HasIndex(Trait trait1, int index)
        {
            var index1 = Traits.IndexOf(trait1) % NumHouses;

            return(Math.Abs(index1 - index));
        }
コード例 #18
0
ファイル: CardState.cs プロジェクト: Pikhota/GameProject
 public CardState(int hp, TraitModel trait)
 {
     HP = hp;
     Traits.Add(trait);
 }
コード例 #19
0
ファイル: Footprint.cs プロジェクト: comradpara/OpenRA
 public static IEnumerable<int2> Tiles(Actor a, Traits.Building building)
 {
     return Tiles( a.Info.Name, a.Info.Traits.Get<BuildingInfo>(), a.Location );
 }
コード例 #20
0
 public override string Generate(Queue <string> generationQueue)
 => _gen($"{string.Join(", ", InterpretQueue(generationQueue, _map).Select(x => x.Generate()))}", Traits.IsNull() ? "" : Traits.Generate());
コード例 #21
0
            public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
            {
                JObject jo = JObject.Load(reader);

                string eventType = jo["type"].Value <string>();

                switch (eventType)
                {
                case "track":
                {
                    string     userId     = jo["userId"].Value <string>();
                    string     eventName  = jo["event"].Value <string>();
                    Properties properties = jo["properties"].ToObject <Properties>();
                    Options    options    = jo["properties"].ToObject <Options>();

                    return(new Track(userId, eventName, properties, options));
                }

                case "screen":
                {
                    string     userId     = jo["userId"].Value <string>();
                    string     name       = jo["name"].Value <string>();
                    string     category   = jo["category"].Value <string>();
                    Properties properties = jo["properties"].ToObject <Properties>();
                    Options    options    = jo["properties"].ToObject <Options>();

                    return(new Screen(userId, name, category, properties, options));
                }

                case "page":
                {
                    string     userId     = jo["userId"].Value <string>();
                    string     name       = jo["name"].Value <string>();
                    string     category   = jo["category"].Value <string>();
                    Properties properties = jo["properties"].ToObject <Properties>();
                    Options    options    = jo["properties"].ToObject <Options>();

                    return(new Page(userId, name, category, properties, options));
                }

                case "identify":
                {
                    string  userId  = jo["userId"].Value <string>();
                    Traits  traits  = jo["traits"].ToObject <Traits>();
                    Options options = jo["properties"].ToObject <Options>();

                    return(new Identify(userId, traits, options));
                }

                case "group":
                {
                    string  userId  = jo["userId"].Value <string>();
                    string  groupId = jo["groupId"].Value <string>();
                    Traits  traits  = jo["traits"].ToObject <Traits>();
                    Options options = jo["properties"].ToObject <Options>();

                    return(new Group(userId, groupId, traits, options));
                }

                case "alias":
                {
                    string  previousId = jo["previousId"].Value <string>();
                    string  userId     = jo["userId"].Value <string>();
                    Options options    = jo["properties"].ToObject <Options>();

                    return(new Alias(previousId, userId, options));
                }

                default:
                    return(null);
                }
            }
コード例 #22
0
 public static void Identify(RudderClient client, Traits traits, RudderOptions options)
 {
     client.Identify("user", traits, options);
     RudderAnalytics.Client.Flush();
 }
コード例 #23
0
ファイル: Hero.cs プロジェクト: gavin-zyi/Ains
 public Task SetTraits(Traits traits)
 {
     this.traits = traits;
     return(TaskDone.Done);
 }
コード例 #24
0
 public override int GetHashCode() => (Traits.GetHashCode() * 759523) ^ base.GetHashCode();
コード例 #25
0
 /// <summary>
 /// The `group` method lets you associate a user with a group. Be it a company,
 /// organization, account, project, team or whatever other crazy name you came up
 /// with for the same concept! It also lets you record custom traits about the
 /// group, like industry or number of employees.
 /// </summary>
 ///
 /// <param name="userId">The visitor's database identifier after they log in, or you know
 /// who they are. By explicitly grouping a user, you tie all of their actions to their group.</param>
 ///
 /// <param name="groupId">The group's database identifier after they log in, or you know
 /// who they are.</param>
 ///
 /// <param name="traits">A dictionary with group keys like "name", “subscriptionPlan”.
 /// You can segment your users by any trait you record. Pass in values in key-value format.
 /// String key, then its value { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param>
 ///
 public void Group(string userId, string groupId, Traits traits)
 {
     Group(userId, groupId, traits, null);
 }
コード例 #26
0
ファイル: ComponentHandle.cs プロジェクト: soelske/mbunit-v3
 public ComponentDescriptorStub(string componentId, object component, Traits traits)
 {
     this.componentId = componentId;
     this.component   = component;
     this.traits      = traits;
 }
コード例 #27
0
ファイル: Client.cs プロジェクト: mrDeadLinez/segmentio-unity
 /// <summary>
 /// Identifying a visitor ties all of their actions to an ID you
 /// recognize and records visitor traits you can segment by.
 /// </summary>
 ///
 /// <param name="userId">The visitor's identifier after they log in, or you know
 /// who they are. By
 /// explicitly identifying a user, you tie all of their actions to their identity.</param>
 ///
 /// <param name="traits">A dictionary with keys like "email", "name", “subscriptionPlan” or
 /// "friendCount”. You can segment your users by any trait you record.
 /// Pass in values in key-value format. String key, then its value
 /// { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param>
 ///
 public void Identify(string userId, Traits traits)
 {
     Identify(userId, traits, null, null);
 }
コード例 #28
0
        /// <summary>
        /// Create virtual FileModel objects from Abc bytecode
        /// </summary>
        /// <param name="abcs"></param>
        /// <param name="path"></param>
        /// <param name="context"></param>
        public static void Convert(ContentParser parser, PathModel path, IASContext context)
        {
            path.Files.Clear();
            inSWF = Path.GetExtension(path.Path).ToLower() == ".swf";

            // extract documentation
            ParseDocumentation(parser);

            // extract models
            FileModel privateClasses = new FileModel(Path.Combine(path.Path, "__Private.as"));

            privateClasses.Version = 3;
            privateClasses.Package = "private";
            genericTypes           = new Dictionary <string, FileModel>();
            imports = new Dictionary <string, string>();

            foreach (Abc abc in parser.Abcs)
            {
                // types
                foreach (Traits trait in abc.classes)
                {
                    Traits instance = trait.itraits;
                    if (instance == null)
                    {
                        continue;
                    }
                    imports.Clear();

                    FileModel model = new FileModel("");
                    model.Context    = context;
                    model.Package    = reSafeChars.Replace(instance.name.uri, "_");
                    model.HasPackage = true;
                    string filename = reSafeChars.Replace(trait.name.ToString(), "_").TrimEnd('$');
                    filename       = Path.Combine(model.Package.Replace('.', Path.DirectorySeparatorChar), filename);
                    model.FileName = Path.Combine(path.Path, filename);
                    model.Version  = 3;

                    ClassModel type = new ClassModel();
                    model.Classes = new List <ClassModel>();
                    model.Classes.Add(type);
                    type.InFile = model;

                    type.Type = instance.name.ToTypeString();
                    type.Name = instance.name.localName;

                    thisDocs = GetDocs(model.Package);
                    if (thisDocs != null)
                    {
                        docPath = (model.Package.Length > 0 ? model.Package + ":" : "globalClassifier:") + type.Name;
                        if (thisDocs.ContainsKey(docPath))
                        {
                            DocItem doc = thisDocs[docPath];
                            setDoc(doc, type);
                            if (doc.Meta != null)
                            {
                                model.MetaDatas = doc.Meta;
                            }
                        }
                        if (model.Package.Length == 0)
                        {
                            docPath = type.Name;
                        }
                    }

                    if (instance.baseName.uri == model.Package)
                    {
                        type.ExtendsType = ImportType(instance.baseName.localName);
                    }
                    else
                    {
                        type.ExtendsType = ImportType(instance.baseName);
                    }

                    if (instance.interfaces != null && instance.interfaces.Length > 0)
                    {
                        type.Implements = new List <string>();
                        foreach (QName name in instance.interfaces)
                        {
                            type.Implements.Add(ImportType(name));
                        }
                    }

                    if (model.Package == "private")
                    {
                        model.Package  = "";
                        type.Access    = Visibility.Private;
                        type.Namespace = "private";
                    }
                    else if (model.Package == "__AS3__.vec")
                    {
                        model.Package  = "";
                        type.Access    = Visibility.Private;
                        type.Namespace = "private";
                        string genType = type.Name;
                        if (type.Name.IndexOf("$") > 0)
                        {
                            string[] itype = type.Name.Split('$');
                            genType        = itype[0];
                            type.Name      = itype[0] + "$" + itype[1];
                            type.IndexType = itype[1];
                        }
                        if (genericTypes.ContainsKey(genType))
                        {
                            model.Classes.Clear();
                            type.InFile = genericTypes[genType];
                            genericTypes[genType].Classes.Add(type);
                        }
                        else
                        {
                            genericTypes[genType] = model;
                        }
                    }
                    else if (type.Name.StartsWith("_"))
                    {
                        type.Access    = Visibility.Private;
                        type.Namespace = "private";
                    }
                    else
                    {
                        type.Access    = Visibility.Public;
                        type.Namespace = "public";
                    }

                    type.Flags = FlagType.Class;
                    if (instance.flags == TraitMember.Function)
                    {
                        type.Flags |= FlagType.Interface;
                    }

                    type.Members = GetMembers(trait.members, FlagType.Static, instance.name);
                    type.Members.Add(GetMembers(instance.members, FlagType.Dynamic, instance.name));

                    if ((type.Flags & FlagType.Interface) > 0)
                    {
                        // TODO properly support interface multiple inheritance
                        type.ExtendsType = null;
                        if (type.Implements != null && type.Implements.Count > 0)
                        {
                            type.ExtendsType = type.Implements[0];
                            type.Implements.RemoveAt(0);
                            if (type.Implements.Count == 0)
                            {
                                type.Implements = null;
                            }
                        }

                        foreach (MemberModel member in type.Members)
                        {
                            member.Access    = Visibility.Public;
                            member.Namespace = "";
                        }
                    }

                    // constructor
                    if (instance.init != null && (type.Flags & FlagType.Interface) == 0)
                    {
                        List <MemberInfo> temp   = new List <MemberInfo>(new MemberInfo[] { instance.init });
                        MemberList        result = GetMembers(temp, 0, instance.name);
                        if (result.Count > 0)
                        {
                            MemberModel ctor = result[0];
                            ctor.Flags    |= FlagType.Constructor;
                            ctor.Access    = Visibility.Public;
                            ctor.Type      = type.Type;
                            ctor.Namespace = "public";
                            type.Members.Merge(result);
                            type.Constructor = ctor.Name;
                        }
                        result = null;
                        temp   = null;
                    }
                    else
                    {
                        type.Constructor = type.Name;
                    }

                    if (type.Access == Visibility.Private)
                    {
                        model       = privateClasses;
                        type.InFile = model;
                    }

                    if (model.Classes.Count > 0 || model.Members.Count > 0)
                    {
                        AddImports(model, imports);
                        path.AddFile(model);
                    }
                }

                // packages
                if (abc.scripts == null)
                {
                    continue;
                }
                foreach (Traits trait in abc.scripts)
                {
                    FileModel model = null;
                    foreach (MemberInfo info in trait.members)
                    {
                        if (info.kind == TraitMember.Class)
                        {
                            continue;
                        }

                        MemberModel member = GetMember(info, 0);
                        if (member == null)
                        {
                            continue;
                        }

                        if (model == null || model.Package != info.name.uri)
                        {
                            AddImports(model, imports);

                            string package  = info.name.uri ?? "";
                            string filename = package.Length > 0 ? "package.as" : "toplevel.as";
                            filename = Path.Combine(package.Replace('.', Path.DirectorySeparatorChar), filename);
                            filename = Path.Combine(path.Path, filename);
                            if (path.HasFile(filename))
                            {
                                model = path.GetFile(filename);
                            }
                            else
                            {
                                model            = new FileModel("");
                                model.Context    = context;
                                model.Package    = package;
                                model.HasPackage = true;
                                model.FileName   = filename;
                                model.Version    = 3;
                                path.AddFile(model);
                            }
                        }

                        thisDocs = GetDocs(model.Package);
                        if (thisDocs != null)
                        {
                            docPath = "globalOperation:" + (model.Package.Length > 0 ? model.Package + ":" : "")
                                      + member.Name;
                            if (member.Access == Visibility.Public && !String.IsNullOrEmpty(member.Namespace) &&
                                member.Namespace != "public")
                            {
                                docPath += member.Namespace + ":";
                            }
                            if ((member.Flags & FlagType.Setter) > 0)
                            {
                                docPath += ":set";
                            }
                            else if ((member.Flags & FlagType.Getter) > 0)
                            {
                                docPath += ":get";
                            }

                            if (thisDocs.ContainsKey(docPath))
                            {
                                setDoc(thisDocs[docPath], member);
                            }
                        }

                        member.InFile         = model;
                        member.IsPackageLevel = true;
                        model.Members.Add(member);
                    }

                    AddImports(model, imports);
                }
            }

            if (privateClasses.Classes.Count > 0)
            {
                path.AddFile(privateClasses);
            }

            // some SWCs need manual fixes
            CustomFixes(path);

            // fake SWC (like 'playerglobal_rb.swc', only provides documentation)
            if (path.Files.Count == 1)
            {
                foreach (FileModel model in path.Files.Values)
                {
                    if (model.GetPublicClass().QualifiedName == "Empty")
                    {
                        path.Files.Clear();
                        break;
                    }
                }
            }
        }
コード例 #29
0
ファイル: Client.cs プロジェクト: mrDeadLinez/segmentio-unity
 /// <summary>
 /// Identifying a visitor ties all of their actions to an ID you
 /// recognize and records visitor traits you can segment by.
 /// </summary>
 ///
 /// <param name="userId">The visitor's identifier after they log in, or you know
 /// who they are. By
 /// explicitly identifying a user, you tie all of their actions to their identity.</param>
 ///
 /// <param name="traits">A dictionary with keys like "email", "name", “subscriptionPlan” or
 /// "friendCount”. You can segment your users by any trait you record.
 /// Pass in values in key-value format. String key, then its value
 /// { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param>
 ///
 /// <param name="context"> A dictionary with additional information thats related to the visit.
 /// Examples are userAgent, and IP address of the visitor.
 /// Feel free to pass in null if you don't have this information.</param>
 ///
 public void Identify(string userId, Traits traits, Context context)
 {
     Identify(userId, traits, null, context);
 }
コード例 #30
0
            public _Pokemon(PokemonTranslator pokemonTranslator, PokemonAvailability._Pokemon _availability, Traits traits, _Stats._MaxStats maxStats) :
                base(pokemonTranslator.Id, pokemonTranslator.Name, pokemonTranslator.Form)
            {
                family       = pokemonTranslator.CandyType;
                buddy_km     = (int)pokemonTranslator.PokemonSettings.km_buddy_distance;
                gender_ratio = pokemonTranslator.GenderRatio;
                rarity       = pokemonTranslator.Rarity;
                shiny        = _availability.shiny;
                ditto        = traits.CanBeDitto(pokemonTranslator);
                var egg = traits.GetEgg(pokemonTranslator);

                availability = (egg != null && string.Equals(_availability.availability, PokeConstants.Availability.HatchOnly)) ?
                               string.Format(PokeConstants.Availability.HatchOnlyFormat, egg.type) :
                               _availability.availability;

                Type = new PokeTypes(pokemonTranslator.Type1, pokemonTranslator.Type2);

                if (pokemonTranslator.EvolvesFromId > 0)
                {
                    EvolvesFrom = new EvolvesFrom(pokemonTranslator);
                }

                Stats = new _Stats(
                    new _Stats.IVScore(pokemonTranslator.PokemonSettings.stats.base_attack, pokemonTranslator.PokemonSettings.stats.base_defense, pokemonTranslator.PokemonSettings.stats.base_stamina),
                    new _Stats.Variation(pokemonTranslator.PokemonSettings.pokedex_height_m, pokemonTranslator.PokemonSettings.pokedex_height_m),
                    new _Stats.Variation(pokemonTranslator.PokemonSettings.pokedex_weight_kg, pokemonTranslator.PokemonSettings.pokedex_weight_kg),
                    new _Stats._Rates(Math.Min(pokemonTranslator.PokemonSettings.encounter.base_capture_rate, 1.0f), pokemonTranslator.PokemonSettings.encounter.base_flee_rate, pokemonTranslator.PokemonSettings.encounter.attack_probability, pokemonTranslator.PokemonSettings.encounter.dodge_probability),
                    maxStats);
            }
コード例 #31
0
ファイル: Mod.cs プロジェクト: KarbonKitty/FrEee
 public void Dispose()
 {
     foreach (var r in AbilityRules.ToArray())
     {
         r.Dispose();
     }
     foreach (var sos in StellarObjectSizes.ToArray())
     {
         sos.Dispose();
     }
     foreach (var x in StellarAbilityTemplates.ToArray())
     {
         x.Dispose();
     }
     foreach (var sot in StellarObjectTemplates.ToArray())
     {
         sot.Dispose();
     }
     foreach (var t in Traits.ToArray())
     {
         t.Dispose();
     }
     foreach (var t in Technologies.ToArray())
     {
         t.Dispose();
     }
     foreach (var f in FacilityTemplates.ToArray())
     {
         f.Dispose();
     }
     foreach (var h in Hulls.ToArray())
     {
         h.Dispose();
     }
     foreach (var c in ComponentTemplates.ToArray())
     {
         c.Dispose();
     }
     foreach (var m in Mounts.ToArray())
     {
         m.Dispose();
     }
     foreach (var sst in StarSystemTemplates.ToArray())
     {
         sst.Dispose();
     }
     foreach (var gt in GalaxyTemplates.ToArray())
     {
         gt.Dispose();
     }
     foreach (var h in HappinessModels.ToArray())
     {
         h.Dispose();
     }
     foreach (var c in Cultures.ToArray())
     {
         c.Dispose();
     }
     foreach (var ai in EmpireAIs.ToArray())
     {
         ai.Dispose();
     }
     if (this == Current)
     {
         Current = null;
     }
 }
コード例 #32
0
ファイル: Hero.cs プロジェクト: gavin-zyi/Ains
 public Task SetTraits(Traits traits)
 {
     this.traits = traits;
     return TaskDone.Done;
 }
コード例 #33
0
                public static Traits operator -(Traits a, Traits b)
                {
                    Traits r = new Traits();

                    r.str = a.str - b.str;
                    r.dex = a.dex - b.dex;
                    r.intel = a.intel - b.intel;
                    r.wis = a.wis - b.wis;
                    r.spd = a.spd - b.spd;
                    r.con = a.con - b.con;

                    return r;
                }
コード例 #34
0
        /// <summary>
        /// Identifying a visitor ties all of their actions to an ID you
        /// recognize and records visitor traits you can segment by.
        /// </summary>
        ///
        /// <param name="userId">The visitor's identifier after they log in, or you know
        /// who they are. By
        /// explicitly identifying a user, you tie all of their actions to their identity.</param>
        ///
        /// <param name="traits">A dictionary with keys like "email", "name", “subscriptionPlan” or
        /// "friendCount”. You can segment your users by any trait you record.
        /// Pass in values in key-value format. String key, then its value
        /// { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param>
        ///
		/// <param name="options">Options allowing you to set timestamp, anonymousId, target integrations,
		/// and the context of th emessage.</param>
        ///
		public void Identify(string userId, Traits traits, Options options)
        {
			if (String.IsNullOrEmpty(userId))
				throw new InvalidOperationException("Please supply a valid userId to Identify.");

			Enqueue(new Identify(userId, traits, options));
        }
コード例 #35
0
        protected IEnumerable <SimTrait.Item> GetChoices(SimDescription me, int max)
        {
            List <SimTrait.Item> allOptions = new List <SimTrait.Item>();

            foreach (Trait trait in TraitManager.GetDictionaryTraits)
            {
                if (!trait.IsReward)
                {
                    continue;
                }

                if (me != null)
                {
                    if (mPreviousChoices.ContainsKey(trait.Guid))
                    {
                        continue;
                    }

                    if (me.TraitManager.HasElement(trait.Guid))
                    {
                        continue;
                    }
                    else if (!trait.TraitValidForAgeSpecies(CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(CASAgeGenderFlags.Adult | me.Species)))
                    {
                        continue;
                    }

                    switch (trait.Guid)
                    {
                    case TraitNames.ForeverYoung:
                        if (!me.AgingEnabled)
                        {
                            continue;
                        }
                        break;
                    }
                }

                if (Traits.IsObjectBaseReward(trait.Guid))
                {
                    if ((me != null) && (me.CreatedSim == null))
                    {
                        continue;
                    }
                }

                allOptions.Add(new SimTrait.Item(trait.Guid, trait.Score));
            }

            if (allOptions.Count == 0)
            {
                return(null);
            }

            string title = Name;

            if (me != null)
            {
                title = me.FullName + Common.NewLine + Common.LocalizeEAString(false, "Ui/Caption/HUD/RewardTraitsShopDialog:Available", new object[] { (int)me.mSpendableHappiness });
            }

            CommonSelection <SimTrait.Item> .Results selection = new CommonSelection <SimTrait.Item>(Name, title, allOptions).SelectMultiple(max);
            if ((selection == null) || (selection.Count == 0))
            {
                return(null);
            }

            if (me != null)
            {
                foreach (SimTrait.Item item in selection)
                {
                    mPreviousChoices[item.Value] = true;
                }
            }

            return(selection);
        }
コード例 #36
0
		/// <summary>
		/// The `group` method lets you associate a user with a group. Be it a company, 
		/// organization, account, project, team or whatever other crazy name you came up 
		/// with for the same concept! It also lets you record custom traits about the 
		/// group, like industry or number of employees.
		/// </summary>
		///
		/// <param name="userId">The visitor's database identifier after they log in, or you know
		/// who they are. By explicitly grouping a user, you tie all of their actions to their group.</param>
		///
		/// <param name="groupId">The group's database identifier after they log in, or you know
		/// who they are.</param>
		///
		/// <param name="traits">A dictionary with group keys like "name", “subscriptionPlan”. 
		/// You can segment your users by any trait you record. Pass in values in key-value format. 
		/// String key, then its value { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param>
		///
		/// <param name="options">Options allowing you to set timestamp, anonymousId, target integrations,
		/// and the context of th emessage.</param>
		///
		public void Group(string userId, string groupId, Traits traits, Options options)
		{
			if (String.IsNullOrEmpty(userId))
				throw new InvalidOperationException("Please supply a valid userId to call #Group.");

			if (String.IsNullOrEmpty(groupId))
				throw new InvalidOperationException("Please supply a valid groupId to call #Group.");

			Enqueue(new Group(userId, groupId, traits, options));
		}
コード例 #37
0
        /// <summary>
        /// Identifying a visitor ties all of their actions to an ID you
        /// recognize and records visitor traits you can segment by.
        /// </summary>
        ///
        /// <param name="userId">The visitor's identifier after they log in, or you know
        /// who they are. By
        /// explicitly identifying a user, you tie all of their actions to their identity.</param>
        ///
        /// <param name="traits">A dictionary with keys like "email", "name", “subscriptionPlan” or
        /// "friendCount”. You can segment your users by any trait you record.
        /// Pass in values in key-value format. String key, then its value
        /// { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param>
        ///
		/// <param name="options">Options allowing you to set timestamp, anonymousId, target integrations,
		/// and the context of th emessage.</param>
        ///
		public void Identify(string userId, Traits traits, Options options)
        {
            EnsureId(userId, options);

            Enqueue(new Identify(userId, traits, options));
        }
コード例 #38
0
        public void Load(JSONCharakter jsonCharakter, List <ITalent> talentListe)
        {
            #region Nullprüfungen
            if (jsonCharakter == null)
            {
                throw new ArgumentNullException(nameof(jsonCharakter));
            }
            else if (talentListe == null)
            {
                throw new ArgumentNullException(nameof(talentListe));
            }
            if (jsonCharakter.MotherLanguages == null)
            {
                jsonCharakter.MotherLanguages = new Dictionary <Guid, bool>();
            }
            if (jsonCharakter.DeductionTalent == null)
            {
                jsonCharakter.DeductionTalent = new Dictionary <Guid, Guid>();
            }
            #endregion
            CreateNew(jsonCharakter.ID);
            Name = jsonCharakter.Name;
            #region Attribute Laden
            foreach (var item in jsonCharakter.AttributeBaseValue.Keys)
            {
                Attribute.SetAKTValue(item, jsonCharakter.AttributeBaseValue[item]);
            }
            #endregion
            #region Values Laden
            if (jsonCharakter.SettableValues != null)
            {
                foreach (var item in jsonCharakter.SettableValues)
                {
                    var settableValue = Values.UsedValues.Where(x => x.Name == item.Key).FirstOrDefault();
                    if (settableValue != null && typeof(AbstractSettableValue).IsAssignableFrom(settableValue.GetType()))
                    {
                        Values.SetAKTValue((AbstractSettableValue)settableValue, item.Value);
                    }
                }
            }
            #endregion
            #region Resources Laden
            //kein Laden notwendig
            #endregion
            #region Traits Laden
            if (jsonCharakter.Traits != null)
            {
                foreach (var item in jsonCharakter.Traits)
                {
                    var trait = new Trait
                    {
                        TraitType   = item.TraitType,
                        Description = item.Description,
                        GP          = item.GP,
                        Title       = item.Title,
                        Value       = item.Value,
                        APEarned    = item.APEarned,
                        APInvest    = item.APInvest
                    };
                    foreach (var innerItems in item.AttributeValues)
                    {
                        trait.SetValue(innerItems.Key, innerItems.Value);
                    }
                    foreach (var innerItems in item.ValueValues)
                    {
                        var value = GetValue(innerItems.Key);
                        if (value != null)
                        {
                            trait.SetValue(value, innerItems.Value);
                        }
                    }
                    foreach (var innerItems in item.ResourceValues)
                    {
                        var res = GetResource(innerItems.Key);
                        if (res != null)
                        {
                            trait.SetValue(res, innerItems.Value);
                        }
                    }

                    foreach (var innerItems in item.TawBonus)
                    {
                        var talent = talentListe.Where(x => x.ID == innerItems.Key).FirstOrDefault();
                        if (talent != null)
                        {
                            trait.SetTaWBonus(talent, innerItems.Value);
                        }
                    }
                    foreach (var innerItems in item.AtBonus)
                    {
                        var talent = talentListe.Where(x => x.ID == innerItems.Key).FirstOrDefault();
                        if (talent != null && typeof(AbstractTalentFighting).IsAssignableFrom(talent.GetType()))
                        {
                            trait.SetATBonus((AbstractTalentFighting)talent, innerItems.Value);
                        }
                    }
                    foreach (var innerItems in item.PaBonus)
                    {
                        var talent = talentListe.Where(x => x.ID == innerItems.Key).FirstOrDefault();
                        if (talent != null && typeof(AbstractTalentFighting).IsAssignableFrom(talent.GetType()))
                        {
                            trait.SetPABonus((AbstractTalentFighting)talent, innerItems.Value);
                        }
                    }
                    if (item.BLBonus != null)
                    {
                        foreach (var innerItems in item.BLBonus)
                        {
                            var talent = talentListe.Where(x => x.ID == innerItems.Key).FirstOrDefault();
                            if (talent != null && typeof(AbstractTalentFighting).IsAssignableFrom(talent.GetType()))
                            {
                                trait.SetBLBonus((AbstractTalentFighting)talent, innerItems.Value);
                            }
                        }
                    }

                    Traits.AddTrait(trait);
                }
            }
            #endregion
            #region Talente Laden
            foreach (var item in jsonCharakter.TalentTAW)
            {
                var talent = talentListe.Where(x => x.ID == item.Key).FirstOrDefault();
                if (talent != null)
                {
                    Talente.SetTAW(talent, item.Value);
                }
                else
                {
                    TalentMissing(jsonCharakter, item.Key);
                }
            }
            foreach (var item in jsonCharakter.TalentAT)
            {
                var talent = talentListe.Where(x => x.ID == item.Key).FirstOrDefault();
                if (talent != null && typeof(AbstractTalentFighting).IsAssignableFrom(talent.GetType()))
                {
                    Talente.SetFightingValue(FightingValue.Attacke, (AbstractTalentFighting)talent, item.Value);
                }
                else
                {
                    TalentMissing(jsonCharakter, item.Key);
                }
            }
            foreach (var item in jsonCharakter.TalentPA)
            {
                var talent = talentListe.Where(x => x.ID == item.Key).FirstOrDefault();
                if (talent != null && typeof(AbstractTalentFighting).IsAssignableFrom(talent.GetType()))
                {
                    Talente.SetFightingValue(FightingValue.Parade, (AbstractTalentFighting)talent, item.Value);
                }
                else
                {
                    TalentMissing(jsonCharakter, item.Key);
                }
            }
            if (jsonCharakter.TalentBL != null)
            {
                foreach (var item in jsonCharakter.TalentBL)
                {
                    var talent = talentListe.Where(x => x.ID == item.Key).FirstOrDefault();
                    if (talent != null && typeof(AbstractTalentFighting).IsAssignableFrom(talent.GetType()))
                    {
                        Talente.SetFightingValue(FightingValue.Blocken, (AbstractTalentFighting)talent, item.Value);
                    }
                    else
                    {
                        TalentMissing(jsonCharakter, item.Key);
                    }
                }
            }
            foreach (var item in jsonCharakter.MotherLanguages)
            {
                var talent = talentListe.Where(x => x.ID == item.Key).FirstOrDefault();
                Talente.SetMother((TalentSpeaking)talent, item.Value);
            }
            foreach (var item in jsonCharakter.DeductionTalent)
            {
                try
                {
                    var talent           = talentListe.Where(x => x.ID == item.Key).FirstOrDefault();
                    var talentDeductions = talent.Deductions.Where(x => x.GetType().IsAssignableFrom(typeof(TalentDeductionTalent))).Cast <TalentDeductionTalent>().ToList();
                    var deduction        = talentDeductions.Where(x => x.Talent.ID == item.Value).FirstOrDefault();
                    Talente.SetDeduction(talent, deduction);
                }
                catch (Exception ex)
                {
                    LogStrings.LogString(LogLevel.ErrorLog, "Fehler beim Laden einer Deduction: " + item.Key + " " + item.Value);
                }
            }
            #endregion
            #region Descriptoren Laden
            foreach (var item in jsonCharakter.Descriptors)
            {
                this.Descriptions.AddDescripton(new Descriptor
                {
                    Priority         = item.Priority,
                    DescriptionText  = item.DescriptionText,
                    DescriptionTitle = item.DescriptionTitle
                });
            }
            #endregion
            #region Money
            #region Money
            if (jsonCharakter.Money != null)
            {
                var money = jsonCharakter.Money;
                Money.Bank = money.Bank;
                Money.D    = money.D;
                Money.H    = money.H;
                Money.K    = money.K;
                Money.S    = money.S;
            }
            #endregion
            #endregion
            #region Anderes Laden
            Other.APEarned   = jsonCharakter.AktAP;
            Other.APInvested = jsonCharakter.InvestAP;
            #endregion
        }
コード例 #39
0
 public Drawback(IObjectStore data) : this()
 {
     Name      = data.GetString("name");
     Weighting = data.GetInteger("weight");
     Traits.Add(data.GetListOptional("traits"));
 }
コード例 #40
0
 /// <summary>
 /// Constructor
 /// </summary>
 public CountryResponse(Continent continent       = null, Country country = null, Model.MaxMind maxMind = null,
                        Country registeredCountry = null, RepresentedCountry representedCountry = null, Traits traits = null)
     : base(continent, country, maxMind, registeredCountry, representedCountry, traits)
 {
 }
コード例 #41
0
 /// <summary>
 /// Identifying a visitor ties all of their actions to an ID you
 /// recognize and records visitor traits you can segment by.
 /// </summary>
 ///
 /// <param name="userId">The visitor's identifier after they log in, or you know
 /// who they are. By
 /// explicitly identifying a user, you tie all of their actions to their identity.</param>
 ///
 /// <param name="traits">A dictionary with keys like "email", "name", “subscriptionPlan” or
 /// "friendCount”. You can segment your users by any trait you record.
 /// Pass in values in key-value format. String key, then its value
 /// { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param>
 ///
 public void Identify(string userId, Traits traits)
 {
     Identify(userId, traits, null);
 }
コード例 #42
0
 public static Box Aabb(Segment seg, Traits traits)
 {
     return(Aabb(seg[0], seg[1], traits.Unit));
 }
コード例 #43
0
		/// <summary>
		/// The `group` method lets you associate a user with a group. Be it a company, 
		/// organization, account, project, team or whatever other crazy name you came up 
		/// with for the same concept! It also lets you record custom traits about the 
		/// group, like industry or number of employees.
		/// </summary>
		///
		/// <param name="userId">The visitor's database identifier after they log in, or you know
		/// who they are. By explicitly grouping a user, you tie all of their actions to their group.</param>
		///
		/// <param name="groupId">The group's database identifier after they log in, or you know
		/// who they are.</param>
		///
		/// <param name="traits">A dictionary with group keys like "name", “subscriptionPlan”. 
		/// You can segment your users by any trait you record. Pass in values in key-value format. 
		/// String key, then its value { String, Integer, Boolean, Double, or Date are acceptable types for a value. } </param>
		///
		public void Group(string userId, string groupId, Traits traits)
		{
			Group (userId, groupId, traits, null);
		}
コード例 #44
0
 public static Box Aabb(Linestring linestring, Traits traits)
 {
     return(Aabb(linestring, false, traits.Unit));
 }
コード例 #45
0
 public static Box Envelope(Segment seg, Traits traits)
 {
     return(Envelope(seg[0], seg[1], traits));
 }
コード例 #46
0
ファイル: Character.cs プロジェクト: syradar/Worldbuilder
 public void AddTrait(Trait t)
 {
     Traits.Add(t);
     AreModifiedAttributesCurrent = false;
 }
コード例 #47
0
		private static void UpdateSegmentIOInformationOnThisUser()
		{
			_traits = new Traits()
			{
				{"lastName", _userInfo.LastName},
				{"firstName", _userInfo.FirstName},
				{"Email", _userInfo.Email},
				{"UILanguage", _userInfo.UILanguageCode},
	            //segmentio collects this in context, but doesn't seem to convey it to MixPanel
	            {"$browser", GetOperatingSystemLabel()}
			};
			foreach (var property in _userInfo.OtherProperties)
			{
				if (!string.IsNullOrWhiteSpace(property.Value))
					_traits.Add(property.Key, property.Value);
			}

			if (!AllowTracking)
				return;

			Segment.Analytics.Client.Identify(AnalyticsSettings.Default.IdForAnalytics, _traits, _options);
		}
コード例 #48
0
ファイル: Player.cs プロジェクト: gavin-zyi/Ains
 public Task SetTraits(Traits traits)
 {
     throw new NotImplementedException();
 }