public bool PosTest1()
 {
     bool retVal = true;
     TestLibrary.TestFramework.BeginScenario("PosTest1:Invoke the MoveNext method in Dictionary ValueCollection Enumerator");
     try
     {
         Dictionary<string, string> dic = new Dictionary<string, string>();
         dic.Add("1", "test1");
         Dictionary<string, string>.ValueCollection.Enumerator ValEnumer1 = new Dictionary<string, string>.ValueCollection(dic).GetEnumerator();
         if (ValEnumer1.Current != null || ValEnumer1.MoveNext() != true)
         {
             TestLibrary.TestFramework.LogError("001.1", "The ExpectResult is not the ActualResult");
             retVal = false;
         }
         if (ValEnumer1.MoveNext())
         {
             TestLibrary.TestFramework.LogError("001.2", "The method MoveNext should return false but it did not");
         }
         ValEnumer1.Dispose();
     }
     catch (Exception e)
     {
         TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
         retVal = false;
     }
     return retVal;
 }
     public JSONStructIterator(JSONEntry oEntry, String strName)
     {
 	    m_object = (Dictionary<string, object>)oEntry.getObject(strName);
         m_enumStruct = m_object.GetEnumerator();
         if (m_enumStruct.MoveNext())
             m_strCurKey = m_enumStruct.Current.Key;
     }
     public JSONStructIterator(JSONEntry oEntry)
     {
 	    m_object = oEntry.getObject();
         m_enumStruct = m_object.GetEnumerator();
         if (m_enumStruct.MoveNext())
             m_strCurKey = m_enumStruct.Current.Key;
     }
 public static float[] BuildBoostList(IEnumerable<string> valArray, IDictionary<string, float> boostMap)
 {
     var valArray2 = new List<string>(valArray.Count());
     // NOTE: we must loop through the list in order to make it format
     // the values so it can match the formatted values in the boostMap.
     foreach (var item in valArray)
     {
         valArray2.Add(item);
     }
     float[] boostList = new float[valArray2.Count];
     Arrays.Fill(boostList, 1.0f);
     if (boostMap != null && boostMap.Count > 0)
     {
         Dictionary<string, float>.Enumerator iter = new Dictionary<string, float>(boostMap).GetEnumerator();
         while (iter.MoveNext())
         {
             KeyValuePair<string, float> entry = iter.Current;
             int index = valArray2.IndexOf(entry.Key);
             if (index >= 0)
             {
                 float fval = entry.Value;
                 if (fval >= 0)
                 {
                     boostList[index] = fval;
                 }
             }
         }
     }
     return boostList;
 }
 public bool PosTest2()
 {
     bool retVal = true;
     TestLibrary.TestFramework.BeginScenario("PosTest2:Return the property Current in Dictionary KeyCollection Enumerator 2");
     try
     {
         Dictionary<string, string> dic = new Dictionary<string, string>();
         dic.Add("1", "test1");
         Dictionary<string, string>.KeyCollection.Enumerator keyEnumer = new Dictionary<string, string>.KeyCollection(dic).GetEnumerator();
         while (keyEnumer.MoveNext())
         {
             if (keyEnumer.Current != "1")
             {
                 TestLibrary.TestFramework.LogError("003", "the ExpectResult is not the ActualResult");
                 retVal = false;
             }
         }
         keyEnumer.Dispose();
     }
     catch (Exception e)
     {
         TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
         retVal = false;
     }
     return retVal;
 }
    public static void ShowSensorSelectionWindow(Vector2 nSize, Rect nPosition, VRPNDataObject nInFront)
    {
        size = nSize;
        pos = nPosition;
        inFront = nInFront;

        sensors = VRPNEditEditor.Instance.GetSensors(inFront.dataName, inFront.originalDataTime, inFront.dataDevice);
        disabledSensors = VRPNEditEditor.Instance.GetDisabledSensors(inFront.dataName, inFront.originalDataTime, inFront.dataDevice);
        states = new bool[sensors.Count];
        sensorsE = sensors.GetEnumerator();

        //Initial sensors state
        int numSensor = 0;
        while (sensorsE.MoveNext())
        {
            int test;
            if (disabledSensors.TryGetValue(sensorsE.Current.Key, out test))
            {
                states[numSensor] = false;
            }
            else
            {
                states[numSensor] = true;
            }
            numSensor++;
        }

        VRPNSensorSelectionWindow window = VRPNSensorSelectionWindow.CreateInstance<VRPNSensorSelectionWindow>();
        window.ShowAsDropDown(pos, size);
    }
        public JSONStructIterator(String szData)
        {
            m_object = (Dictionary<string, object>)JsonParser.JsonDecode(szData);

            m_enumStruct = m_object.GetEnumerator();
            if ( m_enumStruct.MoveNext() )
                m_strCurKey = m_enumStruct.Current.Key;
        }
Exemple #8
0
		public void SetAllActive(bool active)
		{
			enumerator = taskDic.GetEnumerator();
			while(enumerator.MoveNext())
			{
				GameTask task = enumerator.Current.Value;
				task.Active = active;
			}
		}
Exemple #9
0
		public void Update(float deltaTime)
		{
			enumerator = taskDic.GetEnumerator();
			while(enumerator.MoveNext())
			{
				GameTask task = enumerator.Current.Value;
				if (task.Active)
				{
					task.Timer += deltaTime;
					if (task.Delay <= 0f)
					{
						task.Callback();
					}
					else if (task.Timer > task.Delay)
					{
						task.Timer = 0f;
						task.Callback();
					}
				}
			}
		}
 public bool NegTest1()
 {
     bool retVal = true;
     TestLibrary.TestFramework.BeginScenario("NegTest1:The collection was modified after the enumerator was created");
     try
     {
         Dictionary<string, string> dic = new Dictionary<string, string>();
         dic.Add("1", "test1");
         Dictionary<string, string>.ValueCollection.Enumerator ValEnumer = new Dictionary<string, string>.ValueCollection(dic).GetEnumerator();
         dic.Add("2", "test2");
         bool boolVal = ValEnumer.MoveNext();
         TestLibrary.TestFramework.LogError("N001", "The collection was modified after the enumerator was created but not throw exception");
         retVal = false;
     }
     catch (InvalidOperationException) { }
     catch (Exception e)
     {
         TestLibrary.TestFramework.LogError("N002", "Unexpect exception:" + e);
         retVal = false;
     }
     return retVal;
 }
    void UpdateVertices()
    {
        //UnityEngine.Debug.Log ("Update Vertices");

        Stopwatch sw = new Stopwatch();

        sw.Start();

        if (dic_VertexForce.Count == 0)
        {
            deformingMesh.vertices = originalVertices;
            deformingMesh.RecalculateNormals();
            //NormalSolver.RecalculateNormals(deformingMesh, 30);
            return;
        }

        Vector3[,] offsets = new Vector3[originalVertices.Length, dic_VertexForce.Count];

        Dictionary <int, Vector3> .Enumerator it = dic_VertexForce.GetEnumerator();
        int forceIdx = 0;

        while (it.MoveNext())
        {
            int     vertexIdx = it.Current.Key;
            Vector3 force     = it.Current.Value;

            offsets[vertexIdx, forceIdx++] = force;
        }


        // 多组质点弹簧遍历
        it = dic_VertexForce.GetEnumerator();
        Queue <int>   masses = new Queue <int> ();
        HashSet <int> mark   = new HashSet <int> ();

        forceIdx = 0;
        while (it.MoveNext())
        {
            int     vidx_force = it.Current.Key;
            Vector3 force      = it.Current.Value;

            offsets[vidx_force, forceIdx] = force;

            masses.Clear();
            mark.Clear();
            masses.Enqueue(vidx_force);
            mark.Add(vidx_force);

            // 一组质点弹簧遍历
            while (masses.Count > 0)
            {
                int     vidx  = masses.Dequeue();
                Vector3 delta = offsets[vidx, forceIdx];

                // 遍历此节点所有链接点
                Dictionary <int, float>             edge = MassSprings [vidx];
                Dictionary <int, float> .Enumerator iter = edge.GetEnumerator();
                while (iter.MoveNext())
                {
                    int   idx   = iter.Current.Key;
                    float value = iter.Current.Value;

                    int key = vidx > idx ? vidx | (idx << 16) : (vidx << 16) | idx;
                    if (mark.Contains(key))
                    {
                        continue;
                    }

                    Vector3 v = delta / (1 + value / kViscosity);

                    if (v.magnitude <= kThresholdZero)
                    {
                        continue;
                    }

                    if (!dic_VertexForce.ContainsKey(idx) && offsets[idx, forceIdx].sqrMagnitude < v.sqrMagnitude)
                    {
                        offsets[idx, forceIdx] = v;

                        masses.Enqueue(idx);
                    }
                }

                iter = edge.GetEnumerator();
                while (iter.MoveNext())
                {
                    int idx = iter.Current.Key;
                    int key = vidx > idx ? vidx | (idx << 16) : (vidx << 16) | idx;
                    mark.Add(key);
                }
            }

            forceIdx++;
        }


        sw.Stop();
        //UnityEngine.Debug.LogFormat ("using {0}", sw.ElapsedMilliseconds);


        // 计算各顶点偏移量
        for (int i = 0; i < offsets.GetLength(0); i++)
        {
            Vector3 result = Vector3.zero;

            // 计算改顶点最终形变量(x,y,z)
            for (int j = 0; j < 3; j++)
            {
                float positive = 0f;
                float negative = 0f;

                for (int k = 0; k < dic_VertexForce.Count; k++)
                {
                    Vector3 offset = offsets [i, k];
                    float   v      = offset [j];
                    if (v > 0 && v > positive)
                    {
                        positive = v;
                    }
                    else if (v < 0 && v < negative)
                    {
                        negative = v;
                    }
                }

                result [j] = positive + negative;
            }

            // 最终结果保存在第一个位置
            offsets [i, 0] = result;
        }

        // 计算出最新的顶点位置
        for (int i = 0; i < originalVertices.Length; i++)
        {
            displacedVertices [i] = originalVertices [i] + offsets [i, 0];
        }

        deformingMesh.vertices = displacedVertices;
        //deformingMesh.RecalculateNormals ();
        NormalSolver.RecalculateNormals(deformingMesh, 30);
    }
 public void reset()
 {
     m_enumStruct = m_object.GetEnumerator();
     if (m_enumStruct.MoveNext())
         m_strCurKey = m_enumStruct.Current.Key;
 }
Exemple #13
0
        public void ReadAndExecuteCommand(String InputString)
        {

            // Read and execute commend

            #region Check if valid command
            //has to be done via split, because irony doesn't recognize whitespaces,
            //so "dfgfkgdfgkfd" could be detected as the command "df" with an 
            //strange parameter

            if (!IsQuit && ValidCommandFromInputString(InputString))
            {

            #endregion

                #region Prepare Command Execution

                _Scanner = GraphCLICompiler.Scanner;

                _CompilerContext = new CompilerContext(GraphCLICompiler);

                _SourceFile = new SourceFile(InputString, "Source");

                _Scanner.Prepare(_CompilerContext, _SourceFile);

                _CompilerContext.Tokens.Clear();

                _TokenStream = _Scanner.BeginNonDetermisticScan();

                AstNode ExecutionTree = null;

                ExecutionTree = GraphCLICompiler.Parser.ParseNonDeterministic(_CompilerContext, _TokenStream);

                #region Checkt if valid command is complete

                if (ExecutionTree == null)
                {
                    MarkWrongOption(InputString, GraphCLICompiler.Parser.GetCorrectElements(_CompilerContext, _TokenStream));
                }
                else
                {
                    //Carry on, the command is valid and complete
                #endregion

                    ExtractOptionsFromTree(ExecutionTree);

                #endregion

                    if (Commands[CurrentCommand].CLI_Output == CLI_Output.Standard)
                        WriteLine();

                    #region Handle Command Execution

                    //try
                    //{

                        Stopwatch sw = new Stopwatch();
                        sw.Start();

                        // TODO: what's this doing here? 
                        //if (Parameters.Count > 0)
                        //{
                        #region Execute command...

                        if (_GraphDSSharp != null || CurrentCommand.Equals("MKFS") || CurrentCommand.Equals("MOUNT") || CurrentCommand.Equals("QUIT") || CurrentCommand.Equals("EXIT") || CurrentCommand.Equals("USEHISTORY") || CurrentCommand.Equals("SAVEHISTORY"))
                        {


                            Commands[CurrentCommand].Execute(_GraphDSSharp, ref CurrentPath, Parameters, InputString);

                            //if (CommandCategory.Equals(CLICommandCategory.CLIStandardCommand))
                            //{

                                #region Handle Quit and History

                                switch (CurrentCommand.ToUpper())
                                {

                                    case "QUIT":
                                        IsQuit = true;
                                        break;

                                    case "EXIT":
                                        IsQuit = true;
                                        break;

                                    case "USEHISTORY":
                                        //lets move to the right parameter
                                        ParameterEnum = Parameters.GetEnumerator();
                                        ParameterEnum.MoveNext();
                                        ParameterEnum.MoveNext();

                                        switch (ParameterEnum.Current.Key)
                                        {
                                            case "default":
                                                LoadStandardHistory = true;

                                                if (!HistoryFileName.Length.Equals(0))
                                                    SaveHistory(HistoryFileName, SthMountedList);

                                                break;

                                            default:
                                                LoadStandardHistory = false;

                                                HistoryFileName = ParameterEnum.Current.Key;

                                                LoadHistoryFrom(HistoryFileName);

                                                break;

                                        }

                                        break;

                                    case "SAVEHISTORY":
                                        //lets move to the right parameter
                                        ParameterEnum = Parameters.GetEnumerator();
                                        ParameterEnum.MoveNext();
                                        ParameterEnum.MoveNext();

                                        if (LoadStandardHistory)
                                            SaveHistory(ParameterEnum.Current.Key, NothingMountedList);
                                        else
                                            SaveHistory(ParameterEnum.Current.Key, SthMountedList);

                                        break;

                                }

                                #endregion

                            //}

                        }

                        else
                            WriteLine("Nothing mounted...");

                        #endregion
                        //}//CommandArray.Length > 0 ?

                        sw.Stop();

                        if (Parameters.Count > 0 && Commands[CurrentCommand].CLI_Output != CLI_Output.Short)
                        {
                            WriteLine("Command took {0}ms, {1:0.0} MB RAM, {2:0.0}% CPU", sw.ElapsedMilliseconds, _RAMCounter.NextValue() / 1024 / 1024, _CPUCounter.NextValue());
                        }
                    //}
                    //catch (Exception e)
                    //{
                    //    WriteLine("Uuups... " + e.Message);
                    //    WriteLine("StackTrace... " + e.StackTrace);
                    //}

                    Reset();

                    #endregion

                }

            }

                

        }
Exemple #14
0
        /// <summary>
        /// Free all threads, both asleep, and those that do not wish to end peacefully.
        /// Also stop the queue processor only in case it is still running.
        /// </summary>
        protected void Dispose(bool disposeQueueProcessor)
        {
            _running = false;

            if (_sleepingThreads.Count > 0)
            {
                lock (_sleepingThreads)
                {
                    while (_sleepingThreads.Count > 0)
                    {// Wake up all sleeping threads and kill them.
                        ThreadInfo info = _sleepingThreads.Pop();
                        info.MustDispose = true;
                        info.Event.Set();
                    }
                }
            }

            Stopwatch disposeWatch = new Stopwatch();

            if (_threadsHotSwap.Count > 0)
            {
                lock (this)
                {
                    Dictionary <int, ThreadInfo> threadsHotSwap = new Dictionary <int, ThreadInfo>(_threadsHotSwap);
                    while (threadsHotSwap.Count > 0)
                    {
                        using (Dictionary <int, ThreadInfo> .ValueCollection.Enumerator enumerator = threadsHotSwap.Values.GetEnumerator())
                        {
                            if (enumerator.MoveNext() == false)
                            {
                                return;
                            }

                            Thread thread = enumerator.Current.Thread;
                            if (thread.ThreadState == System.Threading.ThreadState.Running ||
                                thread.ThreadState == System.Threading.ThreadState.WaitSleepJoin)
                            {
                                // Some thread is still working, see if we can wait any further.
                                if (_finalDisposeTimeoutMilliseconds > disposeWatch.ElapsedMilliseconds)
                                {// Continue waiting for some more time.
                                    Thread.Sleep(500);
                                    continue;
                                }
                            }

                            StopThread(thread, false, 0, 500);
                            threadsHotSwap.Remove(thread.ManagedThreadId);
                        }
                    }

                    _threadsHotSwap = threadsHotSwap;

                    // Execute under the lock.
                    if (disposeQueueProcessor && _queueProcessorThread != null)
                    {
                        // Finally stop the queue processor in case it is still running.
                        StopThread(_queueProcessorThread, false, 500, 500);
                        _queueProcessorThread = null;
                    }
                }
            }
        }
Exemple #15
0
    ////打开游戏启动画面
    //protected virtual IEnumerator OpenGameBootFace()
    //{
    //    //检测是否有系统启动界面
    //    if (UniGameResources.FindSystemResourcesPackageTable(UniGameResourcesDefine.DefineAssetBundleName_GameBoot) == null)
    //        yield break;
    //    uint guid = UniGameResources.resourcesDownLoadWorker.AllocLoadingAssetObjectGUID();
    //    yield return StartCoroutine(UniGameResources.resourcesDownLoadWorker.LoadingAssetObject(UniGameResourcesDefine.DefineAssetBundleName_GameBoot,
    //                        UniGameResourcesDefine.GameBoot_AssetBundle_Path, guid, typeof(UnityEngine.GameObject), true));
    //    UnityEngine.GameObject obj = UniGameResources.resourcesDownLoadWorker.PutoffAssetObject(guid) as UnityEngine.GameObject;
    //    SceneControl.gameBootFace = obj.GetComponent<UniGameBootFace>();
    //}

    protected virtual IEnumerator BootingSystem()
    {
        //重新设置资源加载模式
        UniGameResources.gameResourcesWorkMode = UniGameResources.GameResourcesWorkMode.Mode_Mobile;
        //语言支持模式
        UniGameResources.gameResourcesWorkModeTwo = UniGameResources.GameResourcesWorkModeTwo.Mode_OutGameOptions;
        //更换成当前的资源加载支持对象
        UniGameResources.uniGameResourcesSupport = new IUniGameResourcesSupport();
        //启动协同程序装载包清单文件
        UniGameResources.AllocResourcesDownLoadWorker();
        yield return(StartCoroutine(UniGameResources.resourcesDownLoadWorker.LoadingGameAssetBundleInventoryPackageFile()));

        //显示启动页面
        //yield return StartCoroutine(OpenGameBootFace());
        SceneControl.gameBootFace = this.gameBootFace;
        //检测当前程序版本是否符合资源版本的要求
        if (UniGameResources.produceInformation.SupportProgramVersion != UniGameResources.uniGameResourcesSupport.ProgramVersion)
        {
            bootingSystemStep = BootingSystemStep.Step_NeedInstallNewVersionProgram;
            yield break;
        }
        //装载要求强制装载的包,这些包不再卸载
        List <string> packageList = new List <string>(8);

        Dictionary <uint, UniGameResourcesPackage> .Enumerator list = UniGameResources.systemResourcesPackageTable.GetEnumerator();
        while (list.MoveNext())
        {
            if (list.Current.Value.assetBundleExistType == UniGameResourcesPackage.AssetBundleExistType.ExistType_ConstraintInstall)
            {
                packageList.Add(list.Current.Value.packageName);
            }
        }
        list.Dispose();
        if (packageList.Count != 0)
        {
            bootingSystemStep           = BootingSystemStep.Step_ConstraintInstallPackage;
            constraintInstallDownloader = UniGameResources.resourcesDownLoadWorker.AllocResourcesDownLoader_DontDestroyOnLoad();
            yield return(StartCoroutine(constraintInstallDownloader.DownloadPackageWithList(packageList)));
        }
        //进行强制下载的资源包
        List <UniGameResourcesPackage> ConstraintDownloadPackageList = UniGameResources.ComparisonSystemResourcesPackageVersion();

        if (ConstraintDownloadPackageList.Count != 0)
        {
            bootingSystemStep            = BootingSystemStep.Step_ConstraintDownloadPackage;
            constraintDownloadDownloader = UniGameResources.resourcesDownLoadWorker.AllocResourcesDownLoader();
            yield return(StartCoroutine(constraintDownloadDownloader.DownloadPackageWithList(ConstraintDownloadPackageList)));

            //下载完是需要卸载的
            UniGameResources.resourcesDownLoadWorker.ReleaseResourcesDownLoader(constraintDownloadDownloader);
            constraintDownloadDownloader = null;
        }
        //保存一次当前资源包版本
        UniGameResources.SaveSystemResourcesPackageVersion();
        //全部处理完毕
        bootingSystemStep = BootingSystemStep.Step_BootingOver;

        //示范代码下载并加载一个资源包内的场景
        //yield return StartCoroutine(UniGameResources.resourcesDownLoadWorker.LoadingGameSceneLevelAdditiveAsync("scene_game", "game"));

        //资源加载工作全部完成,开始初始化程序
        //这里GameRoot的初始化在GameRoot的静态构造函数里
        //这里需要检测GameRoot是否加载完成了
        GameRoot.GameRootInitializationSucceedEvent += OnGameRootInitializationSucceed;
        GameRoot.StartInitialization();
    }
Exemple #16
0
        private IList <Partido> NomenclarPartidoI(string partido, int provincia)
        {
            string          key = provincia + "||" + partido;
            IList <Partido> result;

            if (Cleaning.partidosNomenclados.ContainsKey(key))
            {
                result = Cleaning.partidosNomenclados[key];
            }
            else
            {
                Tokenizer         tokenizer   = Tokenizer.FromString(partido, 1);
                IList <Partido>   enProvincia = base.DAOFactory.PartidoDAO.GetEnProvincia(tokenizer.ToArray(), provincia);
                IList <Localidad> byProvincia = base.DAOFactory.LocalidadDAO.GetByProvincia(tokenizer.ToArray(), provincia);
                double            num         = 0.0;
                IList <Partido>   list        = Cleaning.Nomenclar <Partido>(tokenizer, enProvincia, out num);
                double            num2        = 0.0;
                IList <Localidad> list2       = Cleaning.Nomenclar <Localidad>(tokenizer, byProvincia, out num2);
                bool flag  = list.Count > 0;
                bool flag2 = list2.Count > 0;
                bool flag3 = num > num2;
                bool flag4 = num2 > num;
                bool flag5 = Math.Abs(num2 - num) < 0.01;
                if (flag && flag2 && flag5)
                {
                    List <int> list3 = new List <int>(list.Count);
                    foreach (Partido current in list)
                    {
                        list3.Add(current.Id);
                    }
                    foreach (Localidad current2 in list2)
                    {
                        if (!list3.Contains(current2.Partido.Id))
                        {
                            list.Add(current2.Partido);
                        }
                    }
                }
                else
                {
                    if (flag2 && !flag3)
                    {
                        if (!flag || flag4)
                        {
                            list.Clear();
                            List <int> list3 = new List <int>(list2.Count);
                            foreach (Localidad current2 in list2)
                            {
                                if (!list3.Contains(current2.Partido.Id))
                                {
                                    list3.Add(current2.Partido.Id);
                                    list.Add(current2.Partido);
                                }
                            }
                        }
                    }
                }
                Cleaning.partidosNomenclados.Add(key, list);
                if (Cleaning.partidosNomenclados.Count > 500)
                {
                    using (Dictionary <string, IList <Partido> > .Enumerator enumerator3 = Cleaning.partidosNomenclados.GetEnumerator())
                    {
                        if (enumerator3.MoveNext())
                        {
                            KeyValuePair <string, IList <Partido> > current3 = enumerator3.Current;
                            Cleaning.partidosNomenclados.Remove(current3.Key);
                        }
                    }
                }
                result = list;
            }
            return(result);
        }
        public object FromJson(ITopReader reader, Type type)
        {
            object rsp = null;
            Dictionary <string, TopAttribute> pas = GetTopAttributes(type);

            Dictionary <string, TopAttribute> .Enumerator em = pas.GetEnumerator();
            while (em.MoveNext())
            {
                KeyValuePair <string, TopAttribute> kvp = em.Current;
                TopAttribute ta       = kvp.Value;
                string       itemName = ta.ItemName;
                string       listName = ta.ListName;

                if (!reader.HasReturnField(itemName) && (string.IsNullOrEmpty(listName) || !reader.HasReturnField(listName)))
                {
                    continue;
                }

                object value = null;
                if (ta.ListType != null)
                {
                    value = reader.GetListObjects(listName, itemName, ta.ListType, FromJson);
                }
                else
                {
                    if (typeof(string) == ta.ItemType)
                    {
                        object tmp = reader.GetPrimitiveObject(itemName);
                        if (typeof(string) == tmp.GetType())
                        {
                            value = tmp;
                        }
                        else
                        {
                            if (tmp != null)
                            {
                                value = tmp.ToString();
                            }
                        }
                    }
                    else if (typeof(long) == ta.ItemType)
                    {
                        object tmp = reader.GetPrimitiveObject(itemName);
                        if (typeof(long) == tmp.GetType())
                        {
                            value = tmp;
                        }
                        else
                        {
                            if (tmp != null)
                            {
                                value = long.Parse(tmp.ToString());
                            }
                        }
                    }
                    else if (typeof(bool) == ta.ItemType)
                    {
                        object tmp = reader.GetPrimitiveObject(itemName);
                        if (typeof(bool) == tmp.GetType())
                        {
                            value = tmp;
                        }
                        else
                        {
                            if (tmp != null)
                            {
                                value = bool.Parse(tmp.ToString());
                            }
                        }
                    }
                    else
                    {
                        value = reader.GetReferenceObject(itemName, ta.ItemType, FromJson);
                    }
                }

                if (value != null)
                {
                    if (rsp == null)
                    {
                        rsp = Activator.CreateInstance(type);
                    }
                    ta.Method.Invoke(rsp, new object[] { value });
                }
            }

            return(rsp);
        }
        private static void LoadBoardList()
        {
            BoardsPaths = new Dictionary<string, string>();

            DirectoryInfo di = new DirectoryInfo("Maps");
            FileInfo[] rgFiles = di.GetFiles("*.xml");

            XmlDocument document;
            foreach (FileInfo fi in rgFiles)
            {
                document = new XmlDocument();
                document.Load(fi.FullName);

                String name = document.DocumentElement.GetAttribute("name");

                BoardsPaths.Add(name, fi.FullName);

            }

            String key = String.Empty;
            if (loaded)
            {
                key = enumerator.Current.Key;
            }

            enumerator = BoardsPaths.GetEnumerator();
            enumerator.MoveNext();

            if (loaded)
            {
                bool endReached = false;
                while ((enumerator.Current.Key != key || endReached) && !(enumerator.Current.Key != key && endReached))
                {
                    endReached = !enumerator.MoveNext();
                }

                if (enumerator.Current.Key != key && endReached)
                {
                    enumerator = BoardsPaths.GetEnumerator();
                    enumerator.MoveNext();
                }
            }

            loaded = true;
        }
Exemple #19
0
        protected internal override void OnTick(float dt)
        {
            base.OnTick(dt);
            if (!GameNetwork.IsClientOrReplay && this._tickOccasionallyTimer.Check(MBCommon.GetTime(MBCommon.TimeType.Mission)))
            {
                this.TickOccasionally();
            }
            if (GameNetwork.IsClientOrReplay)
            {
                return;
            }
            List <StandingPoint> standingPointList = (List <StandingPoint>)null;
            List <Agent>         agentList         = (List <Agent>)null;

            foreach (StandingPoint ammoPickUpPoint in this.AmmoPickUpPoints)
            {
                if (ammoPickUpPoint.HasUser)
                {
                    ActionIndexCache currentAction = ammoPickUpPoint.UserAgent.GetCurrentAction(1);
                    if (!(currentAction == StonePile.act_pickup_boulder_begin))
                    {
                        if (currentAction == StonePile.act_pickup_boulder_end)
                        {
                            MissionWeapon weapon    = new MissionWeapon(this._givenItem, (ItemModifier)null, (Banner)null, (short)1);
                            Agent         userAgent = ammoPickUpPoint.UserAgent;
                            userAgent.EquipWeaponToExtraSlotAndWield(ref weapon);
                            userAgent.StopUsingGameObject();
                            this.ConsumeAmmo();
                            if (userAgent.IsAIControlled)
                            {
                                if (agentList == null)
                                {
                                    agentList = new List <Agent>();
                                }
                                agentList.Add(userAgent);
                            }
                        }
                        else if (!ammoPickUpPoint.UserAgent.SetActionChannel(1, StonePile.act_pickup_boulder_begin))
                        {
                            ammoPickUpPoint.UserAgent.StopUsingGameObject();
                        }
                    }
                }
                if (ammoPickUpPoint.HasAIUser || ammoPickUpPoint.HasAIMovingTo)
                {
                    if (standingPointList == null)
                    {
                        standingPointList = new List <StandingPoint>();
                    }
                    standingPointList.Add(ammoPickUpPoint);
                }
            }
            List <StonePile.ThrowingPoint> throwingPointList = (List <StonePile.ThrowingPoint>)null;

            foreach (StonePile.ThrowingPoint throwingPoint in this._throwingPoints)
            {
                throwingPoint.AmmoPickUpPoint = (StandingPointWithWeaponRequirement)null;
                if ((NativeObject)throwingPoint.AttackEntity != (NativeObject)null || throwingPoint.EnemyInRangeTimer.Check(Mission.Current.Time) && (double)throwingPoint.EnemyInRangeTimer.ElapsedTime() < 3.5)
                {
                    throwingPoint.StandingPoint.IsDeactivated = false;
                    MissionWeapon missionWeapon;
                    if (throwingPoint.StandingPoint.HasAIMovingTo)
                    {
                        Dictionary <Agent, UsableMissionObject.MoveInfo> .Enumerator enumerator = throwingPoint.StandingPoint.MovingAgents.GetEnumerator();
                        enumerator.MoveNext();
                        Agent          key = enumerator.Current.Key;
                        EquipmentIndex wieldedItemIndex = key.GetWieldedItemIndex(Agent.HandIndex.MainHand);
                        if (wieldedItemIndex != EquipmentIndex.None)
                        {
                            missionWeapon = key.Equipment[wieldedItemIndex];
                            if (missionWeapon.Item == this._givenItem)
                            {
                                continue;
                            }
                        }
                        key.StopUsingGameObject();
                    }
                    else if (throwingPoint.StandingPoint.HasUser)
                    {
                        Agent          userAgent        = throwingPoint.StandingPoint.UserAgent;
                        EquipmentIndex wieldedItemIndex = userAgent.GetWieldedItemIndex(Agent.HandIndex.MainHand);
                        if (wieldedItemIndex != EquipmentIndex.None)
                        {
                            missionWeapon = userAgent.Equipment[wieldedItemIndex];
                            if (missionWeapon.Item == this._givenItem)
                            {
                                if (userAgent.Controller == Agent.ControllerType.AI && (NativeObject)throwingPoint.AttackEntity != (NativeObject)null)
                                {
                                    userAgent.DisableScriptedCombatMovement();
                                    userAgent.SetScriptedTargetEntityAndPosition(throwingPoint.AttackEntity, new WorldPosition(throwingPoint.AttackEntity.Scene, UIntPtr.Zero, throwingPoint.AttackEntity.GlobalPosition, false));
                                    continue;
                                }
                                continue;
                            }
                        }
                        userAgent.StopUsingGameObject();
                        if (userAgent.Controller == Agent.ControllerType.AI)
                        {
                            userAgent.DisableScriptedCombatMovement();
                        }
                    }
                    else
                    {
                        if (throwingPointList == null)
                        {
                            throwingPointList = new List <StonePile.ThrowingPoint>();
                        }
                        throwingPointList.Add(throwingPoint);
                    }
                }
                else
                {
                    throwingPoint.StandingPoint.IsDeactivated = true;
                }
            }
            if (standingPointList != null)
            {
                for (int index = 0; index < standingPointList.Count; ++index)
                {
                    if (throwingPointList != null && throwingPointList.Count > index)
                    {
                        throwingPointList[index].AmmoPickUpPoint = standingPointList[index] as StandingPointWithWeaponRequirement;
                    }
                    else
                    {
                        standingPointList[index].UserAgent?.StopUsingGameObject();
                        if (standingPointList[index].HasAIMovingTo)
                        {
                            foreach (KeyValuePair <Agent, UsableMissionObject.MoveInfo> keyValuePair in standingPointList[index].MovingAgents.ToList <KeyValuePair <Agent, UsableMissionObject.MoveInfo> >())
                            {
                                keyValuePair.Key.StopUsingGameObject();
                            }
                            standingPointList[index].MovingAgents.Clear();
                        }
                    }
                }
            }
            if (agentList == null)
            {
                return;
            }
            foreach (Agent agent in agentList)
            {
                this.AssignAgentToStandingPoint(this.GetSuitableStandingPointFor(this.Side, agent, (IEnumerable <Agent>)null, (IEnumerable <AgentValuePair <float> >)null), agent);
            }
        }
        /// <summary>
        /// Metoda która zwraca zdjêcia nale¿ace do albumu który w³aœnie klikneliœmy
        /// </summary>
        /// <param name="Node">wêz³ drzewa z którego wy³usamy nazwe albumu</param>
        /// <returns>lista zdjêæ która zosta³a utworzona przez przeszukanie bazy</returns>
        private List <Zdjecie> ZwrocZdjeciaZAlbumu(TreeNode Node)
        {
            Db baza = new Db();

            Dictionary <Int64, string> nieOdnalezione = new Dictionary <long, string>();
            //List<Int64> nieOdnalezione = new List<Int64>();
            List <Zdjecie> lista = new List <Zdjecie>();

            DataSet ds = null;
            string  pelna_sciezka;

            baza.Polacz();

            try
            {
                if (Node.FullPath.IndexOf("Albumy") == 0 && Node.FullPath.Length > "Albumy".Length)
                {
                    ds = baza.Select("select sciezka,nazwa_pliku,id_zdjecia from zdjecie where id_zdjecia in (select id_zdjecia from TagZdjecia where id_tagu in (select id_tagu from Tag where album=1 and nazwa=\'" + Node.FullPath.Substring("Albumy".Length + 1, Node.FullPath.Length - ("Albumy".Length + 1)) + "\'))");
                }
                else if (Node.FullPath.IndexOf("Albumy") == 0)
                {
                    ds = baza.Select("select sciezka,nazwa_pliku,id_zdjecia from zdjecie where id_zdjecia in (select id_zdjecia from TagZdjecia where id_tagu in (select id_tagu from Tag where album=1))");
                }
                pelna_sciezka = "";

                foreach (DataTable t in ds.Tables)
                {
                    foreach (DataRow r in t.Rows)
                    {
                        if (!(r[0] is DBNull))
                        {
                            pelna_sciezka = r[0] + "\\" + r[1];

                            if (System.IO.File.Exists(pelna_sciezka) == true)
                            {
                                Zdjecie z = new Zdjecie(pelna_sciezka);
                                lista.Add(z);
                            }
                            else
                            {
                                nieOdnalezione.Add((Int64)r[2], pelna_sciezka);
                            }
                        }
                    }
                }
            }
            catch (SqlException)
            {
                MessageBox.Show("blad bazy");
            }

            baza.Rozlacz();

            if (nieOdnalezione.Count > 0)
            {
                Dictionary <long, string> .Enumerator enu = nieOdnalezione.GetEnumerator();
                KeyValuePair <long, string>           kv;
                enu.MoveNext();
                while (true)
                {
                    kv = enu.Current;
                    ZnajdzPliki  zp = new ZnajdzPliki(kv);
                    DialogResult dr = zp.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        if (zp.czyOdnaleziono())
                        {
                            Zdjecie odnalezioneZdjecie = new Zdjecie(zp.OdnalezionyPlik);
                            odnalezioneZdjecie.ZweryfikujZdjecie();
                            lista.Add(odnalezioneZdjecie);
                            if (!enu.MoveNext())
                            {
                                break;
                            }
                        }
                    }
                    else if (dr == DialogResult.Cancel)
                    {
                        if (!enu.MoveNext())
                        {
                            break;
                        }
                    }
                    else if (dr == DialogResult.Abort)
                    {
                        break;
                    }
                }
            }

            return(lista);
        }
            protected override IEnumerator <IteratorAsyncResult <SendAvailabilityMessagePump.ProcessQueueAsyncResult> .AsyncStep> GetAsyncSteps()
            {
                object obj;
                List <BrokeredMessage> brokeredMessages;
                MessageSender          retryPolicy;
                bool             flag = false;
                HashSet <string> strs = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

                do
                {
                    if (base.RemainingTime() < SendAvailabilityMessagePump.ProcessQueueAsyncResult.MinTimeToProcessLoop)
                    {
                        break;
                    }
                    base.LastAsyncStepException = null;
                    IEnumerable <BrokeredMessage> brokeredMessages1 = null;
                    bool flag1 = false;
                    if (!this.pump.CanPump())
                    {
                        break;
                    }
                    SendAvailabilityMessagePump.ProcessQueueAsyncResult processQueueAsyncResult = this;
                    yield return(processQueueAsyncResult.CallAsync((SendAvailabilityMessagePump.ProcessQueueAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.messageReceiver.BeginTryReceive(100, SendAvailabilityMessagePump.ProcessQueueAsyncResult.DefaultReadTimeout, c, s), (SendAvailabilityMessagePump.ProcessQueueAsyncResult thisPtr, IAsyncResult r) => flag1 = this.messageReceiver.EndTryReceive(r, out brokeredMessages1), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue));

                    if (base.LastAsyncStepException != null)
                    {
                        MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWritePairedNamespaceMessagePumpReceiveFailed(this.messageReceiver.MessagingFactory.Address.ToString(), this.messageReceiver.Path, base.LastAsyncStepException));
                        if (!Fx.IsFatal(base.LastAsyncStepException) && !(base.LastAsyncStepException is UnauthorizedAccessException) && !(base.LastAsyncStepException is MessagingEntityNotFoundException))
                        {
                            break;
                        }
                        base.Complete(base.LastAsyncStepException);
                        break;
                    }
                    else if (!flag1 || brokeredMessages1 == null)
                    {
                        flag = true;
                    }
                    else
                    {
                        this.messagesToDispose.AddRange(brokeredMessages1);
                        Dictionary <string, List <BrokeredMessage> > strs1 = new Dictionary <string, List <BrokeredMessage> >();
                        foreach (BrokeredMessage brokeredMessage in brokeredMessages1)
                        {
                            MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWritePairedNamespaceReceiveMessageFromSecondary(brokeredMessage.SequenceNumber, this.messageReceiver.Path));
                            base.LastAsyncStepException = null;
                            if (!brokeredMessage.Properties.TryGetValue("x-ms-path", out obj) || !(obj is string))
                            {
                                BrokeredMessage brokeredMessage1 = brokeredMessage;
                                string          messageId        = brokeredMessage.MessageId;
                                MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWritePairedNamespaceMessageNoPathInBacklog(this.messageReceiver.MessagingFactory.Address.ToString(), this.messageReceiver.Path, messageId));
                                yield return(base.CallAsync((SendAvailabilityMessagePump.ProcessQueueAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => brokeredMessage1.BeginDeadLetter(SRClient.BacklogDeadletterReasonNoQueuePath, SRClient.BacklogDeadletterDescriptionNoQueuePath, c, s), (SendAvailabilityMessagePump.ProcessQueueAsyncResult thisPtr, IAsyncResult r) => brokeredMessage1.EndDeadLetter(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue));
                            }
                            else
                            {
                                string str = (string)obj;
                                if (!strs.Contains(str))
                                {
                                    if (!strs1.TryGetValue(str, out brokeredMessages))
                                    {
                                        brokeredMessages = new List <BrokeredMessage>();
                                        strs1.Add(str, brokeredMessages);
                                    }
                                    brokeredMessages.Add(brokeredMessage);
                                }
                            }
                        }
                        Dictionary <string, List <BrokeredMessage> > .KeyCollection.Enumerator enumerator = strs1.Keys.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                string current = enumerator.Current;
                                base.LastAsyncStepException = null;
                                string str1 = current;
                                List <BrokeredMessage> item = strs1[current];
                                retryPolicy = null;
                                yield return(base.CallAsync((SendAvailabilityMessagePump.ProcessQueueAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.pump.options.PrimaryMessagingFactory.BeginCreateMessageSender(null, str1, false, t, c, s), (SendAvailabilityMessagePump.ProcessQueueAsyncResult thisPtr, IAsyncResult r) => retryPolicy = thisPtr.pump.options.PrimaryMessagingFactory.EndCreateMessageSender(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue));

                                if (base.LastAsyncStepException == null)
                                {
                                    retryPolicy.ShouldLinkRetryPolicy = true;
                                    retryPolicy.RetryPolicy           = this.pump.options.PrimaryMessagingFactory.RetryPolicy;
                                    if (!this.pump.CanPump())
                                    {
                                        goto Label1;
                                    }
                                    SendAvailabilityMessagePump.ProcessQueueAsyncResult processQueueAsyncResult1 = this;
                                    List <BrokeredMessage> brokeredMessages2 = item;
                                    IteratorAsyncResult <SendAvailabilityMessagePump.ProcessQueueAsyncResult> .BeginCall <BrokeredMessage> sendAsyncResult = (SendAvailabilityMessagePump.ProcessQueueAsyncResult thisPtr, BrokeredMessage i, TimeSpan t, AsyncCallback c, object s) => new SendAvailabilityMessagePump.SendAsyncResult(retryPolicy, i, this.pump, this.pump.options.PrimaryMessagingFactory.OperationTimeout, c, s);
                                    yield return(processQueueAsyncResult1.CallParallelAsync <BrokeredMessage>(brokeredMessages2, sendAsyncResult, (SendAvailabilityMessagePump.ProcessQueueAsyncResult thisPtr, BrokeredMessage i, IAsyncResult r) => AsyncResult <SendAvailabilityMessagePump.SendAsyncResult> .End(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue));

                                    if (base.LastAsyncStepException != null && !strs.Contains(current))
                                    {
                                        strs.Add(current);
                                    }
                                    if (!retryPolicy.IsOpened)
                                    {
                                        continue;
                                    }
                                    SendAvailabilityMessagePump.ProcessQueueAsyncResult processQueueAsyncResult2 = this;
                                    IteratorAsyncResult <SendAvailabilityMessagePump.ProcessQueueAsyncResult> .BeginCall beginCall = (SendAvailabilityMessagePump.ProcessQueueAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => retryPolicy.BeginClose(thisPtr.RemainingTime(), c, s);
                                    yield return(processQueueAsyncResult2.CallAsync(beginCall, (SendAvailabilityMessagePump.ProcessQueueAsyncResult thisPtr, IAsyncResult r) => retryPolicy.EndClose(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue));

                                    if (base.LastAsyncStepException == null)
                                    {
                                        continue;
                                    }
                                    MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWritePairedNamespaceMessagePumpProcessCloseSenderFailed(base.LastAsyncStepException));
                                }
                                else
                                {
                                    MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWritePairedNamespaceCouldNotCreateMessageSender(this.messageReceiver.MessagingFactory.Address.ToString(), this.messageReceiver.Path, base.LastAsyncStepException));
                                }
                            }
                            goto Label0;
Label1:
                            retryPolicy.Abort();
                            break;
                        }
                        finally
                        {
                            ((IDisposable)enumerator).Dispose();
                        }
                    }
Label0:
                }while (!flag);
            }
Exemple #22
0
        // Based on the measurement type and result, show a bunch of stuff
        void FieldFiller()
        {
            Measurement m    = N.App.Opstate.Measurement;
            int         rep  = m.CountingAnalysisResults.GetResultsCount(typeof(Multiplicity));
            int         i    = 0;
            IEnumerator iter = m.CountingAnalysisResults.GetMultiplicityEnumerator();

            while (iter.MoveNext())
            {
                i++;
                string             augmenter = (rep > 1 ? " " + i.ToString() : ""); // use mkey indicator here, not just this indexer
                Multiplicity       mkey      = (Multiplicity)((KeyValuePair <SpecificCountingAnalyzerParams, object>)(iter.Current)).Key;
                INCCResult         r;
                MeasOptionSelector moskey = new MeasOptionSelector(m.MeasOption, mkey);
                bool found = m.INCCAnalysisResults.TryGetValue(moskey, out r);  // APluralityOfMultiplicityAnalyzers:
                switch (m.MeasOption)
                {
                case AssaySelector.MeasurementOption.rates:
                case AssaySelector.MeasurementOption.background:
                    //if (passive)
                    listView1.Items.Add(new ListViewItem(new string[] { "Passive rates" + augmenter }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format(" Singles: {0,13:F3} +- {1,9:F3}", r.DeadtimeCorrectedSinglesRate.v, r.DeadtimeCorrectedSinglesRate.err)
                    }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format(" Doubles: {0,13:F3} +- {1,9:F3}", r.DeadtimeCorrectedDoublesRate.v, r.DeadtimeCorrectedDoublesRate.err)
                    }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format(" Triples: {0,13:F3} +- {1,9:F3}", r.DeadtimeCorrectedTriplesRate.v, r.DeadtimeCorrectedTriplesRate.err)
                    }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("Scaler 1: {0,13:F3} +- {1,9:F3}", r.Scaler1Rate.v, r.Scaler1Rate.err)
                    }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("Scaler 2: {0,13:F3} +- {1,9:F3}", r.Scaler2Rate.v, r.Scaler2Rate.err)
                    }));
                    //if (active)
                    break;

                case AssaySelector.MeasurementOption.initial:
                    INCCResults.results_init_src_rec isr = (INCCResults.results_init_src_rec)r;
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("                 Source id: {0}", isr.init_src_id)
                    }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("Initial source measurement: {0}", (isr.pass ? "passed" : "failed"))
                    }));
                    break;

                case AssaySelector.MeasurementOption.normalization:
                    INCCResults.results_bias_rec br = (INCCResults.results_bias_rec)r;
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("Normalization results for reference source: {0}", br.sourceId)
                    }));
                    if (br.mode == NormTest.Cf252Doubles)
                    {
                        listView1.Items.Add(new ListViewItem(new string[] {
                            string.Format("Normalization doubles rate expected/measured: {0,13:F3} +- {1,9:F3}",
                                          br.biasDblsRateExpectMeas.v, br.biasDblsRateExpectMeas.err)
                        }));
                    }
                    else if (br.mode == NormTest.Cf252Singles)
                    {
                        listView1.Items.Add(new ListViewItem(new string[] {
                            string.Format("Normalization singles rate expected/measured: {0,13:F3} +- {1,9:F3}",
                                          br.biasDblsRateExpectMeas.v, br.biasDblsRateExpectMeas.err)
                        }));
                    }
                    else
                    {
                        listView1.Items.Add(new ListViewItem(new string[] {
                            string.Format("Normalization singles rate expected/measured: {0,13:F3} +- {1,9:F3}",
                                          br.biasSnglsRateExpectMeas.v, br.biasSnglsRateExpectMeas.err)
                        }));
                    }
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("Normalization test {0}", (br.pass ? "passed" : "failed"))
                    }));
                    break;

                case AssaySelector.MeasurementOption.precision:
                    INCCResults.results_precision_rec pr = (INCCResults.results_precision_rec)r;
                    listView1.Items.Add(new ListViewItem(new string[] { "Precision results" + augmenter }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("Chi-square lower limit: {0,13:F3}", pr.chiSqLowerLimit)
                    }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("Chi-square upper limit: {0,13:F3}", pr.chiSqUpperLimit)
                    }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("       Sample variance: {0,13:F3}", pr.precSampleVar)
                    }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("  Theoretical variance: {0,13:F3}", pr.precTheoreticalVar)
                    }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("            Chi-square: {0,13:F3}", pr.precChiSq)
                    }));
                    listView1.Items.Add(new ListViewItem(new string[] {
                        string.Format("Precision test {0}.", (pr.pass ? "passed" : "failed"))
                    }));
                    break;

                case AssaySelector.MeasurementOption.calibration:
                    INCCMethodResults imrs;
                    bool ok = m.INCCAnalysisResults.TryGetINCCResults(moskey.MultiplicityParams, out imrs);
                    if (ok && imrs.Count > 0)     // should be true for verification and calibration
                    {
                        // we've got a distinct detector id and material type on the methods, so that is the indexer here
                        Dictionary <AnalysisMethod, INCCMethodResult> amimr = imrs[m.INCCAnalysisState.Methods.selector];

                        // now get an enumerator over the map of method results
                        Dictionary <AnalysisMethod, INCCMethodResult> .Enumerator ai = amimr.GetEnumerator();
                        while (ai.MoveNext())
                        {
                            INCCMethodResult imr = ai.Current.Value;
                            if (imr is INCCMethodResults.results_cal_curve_rec)
                            {
                                listView1.Items.Add(new ListViewItem(new string[] { "Passive calibration curve results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("       Pu mass: {0,13:F3}", ((INCCMethodResults.results_cal_curve_rec)imr).pu_mass.v)
                                }));
                            }
                            else if (imr is INCCMethodResults.results_known_alpha_rec)
                            {
                                listView1.Items.Add(new ListViewItem(new string[] { "Known alpha results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("Multiplication: {0,13:F3}", ((INCCMethodResults.results_known_alpha_rec)imr).mult)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("         Alpha: {0,13:F3}", ((INCCMethodResults.results_known_alpha_rec)imr).alphaK)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("       Pu mass: {0,13:F3}", ((INCCMethodResults.results_known_alpha_rec)imr).pu_mass.v)
                                }));
                            }
                            else if (imr is INCCMethodResults.results_add_a_source_rec)
                            {
                                listView1.Items.Add(new ListViewItem(new string[] { "Add-a-source results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("       Pu mass: {0,13:F3}", ((INCCMethodResults.results_add_a_source_rec)imr).pu_mass.v)
                                }));
                            }
                            else if (imr is INCCMethodResults.results_active_rec)
                            {
                                listView1.Items.Add(new ListViewItem(new string[] { "Active calibration curve results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("      U235 mass: {0,13:F3}", ((INCCMethodResults.results_active_rec)imr).u235_mass.v)
                                }));
                            }
                        }
                    }
                    break;

                case AssaySelector.MeasurementOption.verification:
                case AssaySelector.MeasurementOption.holdup:
                    INCCMethodResults imrvs;
                    bool okv = m.INCCAnalysisResults.TryGetINCCResults(moskey.MultiplicityParams, out imrvs);
                    if (okv && imrvs.Count > 0)     // should be true for verification and calibration
                    {
                        // we've got a distinct detector id and material type on the methods, so that is the indexer here
                        Dictionary <AnalysisMethod, INCCMethodResult> amimr = imrvs[m.INCCAnalysisState.Methods.selector];

                        // now get an enumerator over the map of method results
                        Dictionary <AnalysisMethod, INCCMethodResult> .Enumerator ai = amimr.GetEnumerator();
                        while (ai.MoveNext())
                        {
                            INCCMethodResult imr = ai.Current.Value;
                            if (imr is INCCMethodResults.results_cal_curve_rec)
                            {
                                INCCMethodResults.results_cal_curve_rec d = (INCCMethodResults.results_cal_curve_rec)imr;
                                listView1.Items.Add(new ListViewItem(new string[] { "Passive calibration curve results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                 Pu mass: {0,13:F3} +- {1,9:F3}", d.pu_mass.v, d.pu_mass.err)
                                }));
                                if (d.dcl_pu_mass > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("        Declared Pu mass: {0,13:F3}", d.dcl_pu_mass)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("Declared - assay Pu mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.dcl_minus_asy_pu_mass.v, d.dcl_minus_asy_pu_mass.err, d.dcl_minus_asy_pu_mass_pct)
                                    }));
                                }
                            }
                            else if (imr is INCCMethodResults.results_known_alpha_rec)
                            {
                                INCCMethodResults.results_known_alpha_rec d = (INCCMethodResults.results_known_alpha_rec)imr;
                                listView1.Items.Add(new ListViewItem(new string[] { "Known alpha results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("          Multiplication: {0,13:F3}", d.mult)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                   Alpha: {0,13:F3}", d.alphaK)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                 Pu mass: {0,13:F3} +- {1,9:F3}", d.pu_mass.v, d.pu_mass.err)
                                }));
                                if (d.dcl_pu_mass > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("        Declared Pu mass: {0,13:F3}", d.dcl_pu_mass)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("Declared - assay Pu mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.dcl_minus_asy_pu_mass.v, d.dcl_minus_asy_pu_mass.err, d.dcl_minus_asy_pu_mass_pct)
                                    }));
                                }
                            }
                            else if (imr is INCCMethodResults.results_known_m_rec)
                            {
                                INCCMethodResults.results_known_m_rec d = (INCCMethodResults.results_known_m_rec)imr;
                                listView1.Items.Add(new ListViewItem(new string[] { "Known M results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("          Multiplication: {0,13:F3}", d.mult)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                   Alpha: {0,13:F3}", d.alpha)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                 Pu mass: {0,13:F3} +- {1,9:F3}", d.pu_mass.v, d.pu_mass.err)
                                }));
                                if (d.dcl_pu_mass > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("        Declared Pu mass: {0,13:F3}", d.dcl_pu_mass)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("Declared - assay Pu mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.dcl_minus_asy_pu_mass.v, d.dcl_minus_asy_pu_mass.err, d.dcl_minus_asy_pu_mass_pct)
                                    }));
                                }
                            }
                            else if (imr is INCCMethodResults.results_multiplicity_rec)
                            {
                                INCCMethodResults.results_multiplicity_rec d = (INCCMethodResults.results_multiplicity_rec)imr;
                                listView1.Items.Add(new ListViewItem(new string[] { "Passive multiplicity results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("          Multiplication: {0,13:F3} +- {1,9:F3}", d.mult.v, d.mult.err)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                   Alpha: {0,13:F3} +- {1,9:F3}", d.alphaK.v, d.alphaK.err)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("       Correction factor: {0,13:F3}", d.corr_factor.v, d.corr_factor.err)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                 Pu mass: {0,13:F3} +- {1,9:F3}", d.pu_mass.v, d.pu_mass.err)
                                }));
                                if (d.dcl_pu_mass > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("        Declared Pu mass: {0,13:F3}", d.dcl_pu_mass)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("Declared - assay Pu mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.dcl_minus_asy_pu_mass.v, d.dcl_minus_asy_pu_mass.err, d.dcl_minus_asy_pu_mass_pct)
                                    }));
                                }
                            }
                            else if (imr is INCCMethodResults.results_add_a_source_rec)
                            {
                                INCCMethodResults.results_add_a_source_rec d = (INCCMethodResults.results_add_a_source_rec)imr;
                                listView1.Items.Add(new ListViewItem(new string[] { "Add-a-source results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                   Delta: {0,13:F3} +- {1,9:F3}", d.delta.v, d.delta.err)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("       Correction factor: {0,13:F3}", d.corr_factor.v, d.corr_factor.err)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                 Pu mass: {0,13:F3} +- {1,9:F3}", d.pu_mass.v, d.pu_mass.err)
                                }));
                                if (d.dcl_pu_mass > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("        Declared Pu mass: {0,13:F3}", d.dcl_pu_mass)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("Declared - assay Pu mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.dcl_minus_asy_pu_mass.v, d.dcl_minus_asy_pu_mass.err, d.dcl_minus_asy_pu_mass_pct)
                                    }));
                                }
                            }
                            else if (imr is INCCMethodResults.results_curium_ratio_rec)
                            {
                                INCCMethodResults.results_curium_ratio_rec d = (INCCMethodResults.results_curium_ratio_rec)imr;
                                listView1.Items.Add(new ListViewItem(new string[] { "Curium ratio results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                 Cm mass: {0,13:F3}  +- {1,9:F3}", d.cm_mass.v, d.cm_mass.err)
                                }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                 Pu mass: {0,13:F3} +- {1,9:F3}", d.pu.pu_mass.v, d.pu.pu_mass.err)
                                }));
                                if (d.pu.dcl_pu_mass > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("        Declared Pu mass: {0,13:F3}", d.pu.dcl_pu_mass)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("Declared - assay Pu mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.pu.dcl_minus_asy_pu_mass.v, d.pu.dcl_minus_asy_pu_mass.err, d.pu.dcl_minus_asy_pu_mass_pct)
                                    }));
                                }
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                  U mass: {0,13:F3} +- {1,9:F3}", d.u.mass.v, d.u.mass.err)
                                }));
                                if (d.u.dcl_mass > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("         Declared U mass: {0,13:F3}", d.u.dcl_mass)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format(" Declared - assay U mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.u.dcl_minus_asy_mass.v, d.u.dcl_minus_asy_mass.err, d.u.dcl_minus_asy_mass_pct)
                                    }));
                                }
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("      Declared U235 mass: {0,13:F3} +- {1,9:F3}", d.u235.mass.v, d.u235.mass.err)
                                }));
                                if (d.u235.dcl_mass > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("      Declared U235 mass: {0,13:F3}", d.u235.dcl_mass)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("  Decl - assay U235 mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.u235.dcl_minus_asy_mass.v, d.u235.dcl_minus_asy_mass.err, d.u235.dcl_minus_asy_mass_pct)
                                    }));
                                }
                            }
                            else if (imr is INCCMethodResults.results_truncated_mult_rec)
                            {
                                INCCMethodResults.results_truncated_mult_rec d = (INCCMethodResults.results_truncated_mult_rec)imr;
                                if (d.methodParams.known_eff)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] { "Known efficiency truncated multiplicity results" + augmenter }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("                 Pu mass: {0,13:F3} +- {1,9:F3}", d.k.pu_mass.v, d.k.pu_mass.err)
                                    }));
                                    if (d.k.dcl_pu_mass > 0)
                                    {
                                        listView1.Items.Add(new ListViewItem(new string[] {
                                            string.Format("        Declared Pu mass: {0,13:F3}", d.k.dcl_pu_mass)
                                        }));
                                        listView1.Items.Add(new ListViewItem(new string[] {
                                            string.Format("Declared - assay Pu mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                          d.k.dcl_minus_asy_pu_mass.v, d.k.dcl_minus_asy_pu_mass.err, d.k.dcl_minus_asy_pu_mass_pct)
                                        }));
                                    }
                                }
                                if (d.methodParams.solve_eff)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] { "Solve efficiency truncated multiplicity results" + augmenter }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("                 Pu mass: {0,13:F3} +- {1,9:F3}", d.s.pu_mass.v, d.s.pu_mass.err)
                                    }));
                                    if (d.s.dcl_pu_mass > 0)
                                    {
                                        listView1.Items.Add(new ListViewItem(new string[] {
                                            string.Format("        Declared Pu mass: {0,13:F3}", d.s.dcl_pu_mass)
                                        }));
                                        listView1.Items.Add(new ListViewItem(new string[] {
                                            string.Format("Declared - assay Pu mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                          d.s.dcl_minus_asy_pu_mass.v, d.s.dcl_minus_asy_pu_mass.err, d.s.dcl_minus_asy_pu_mass_pct)
                                        }));
                                    }
                                }
                            }
                            else if (imr is INCCMethodResults.results_active_rec)
                            {
                                INCCMethodResults.results_active_rec d = (INCCMethodResults.results_active_rec)imr;
                                listView1.Items.Add(new ListViewItem(new string[] { "Active calibration curve results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                 U235 mass: {0,13:F3} +- {1,9:F3}", d.u235_mass.v, d.u235_mass.err)
                                }));
                                if (d.dcl_u235_mass > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("        Declared U235 mass: {0,13:F3}", d.dcl_u235_mass)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("Declared - assay U235 mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.dcl_minus_asy_u235_mass.v, d.dcl_minus_asy_u235_mass.err, d.dcl_minus_asy_u235_mass_pct)
                                    }));
                                }
                            }
                            else if (imr is INCCMethodResults.results_active_passive_rec)
                            {
                                INCCMethodResults.results_active_passive_rec d = (INCCMethodResults.results_active_passive_rec)imr;
                                listView1.Items.Add(new ListViewItem(new string[] { "Active/passive results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                 U235 mass: {0,13:F3} +- {1,9:F3}", d.u235_mass.v, d.u235_mass.err)
                                }));
                                if (d.dcl_u235_mass > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("        Declared U235 mass: {0,13:F3}", d.dcl_u235_mass)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("Declared - assay U235 mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.dcl_minus_asy_u235_mass.v, d.dcl_minus_asy_u235_mass.err, d.dcl_minus_asy_u235_mass_pct)
                                    }));
                                }
                            }
                            else if (imr is INCCMethodResults.results_collar_rec)
                            {
                                INCCMethodResults.results_collar_rec d = (INCCMethodResults.results_collar_rec)imr;
                                listView1.Items.Add(new ListViewItem(new string[] { "Collar results" + augmenter }));
                                listView1.Items.Add(new ListViewItem(new string[] {
                                    string.Format("                 U235 mass: {0,13:F3} +- {1,9:F3}", d.u235_mass.v, d.u235_mass.err)
                                }));
                                if (d.dcl_total_u235.v > 0)
                                {
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("        Declared U235 mass: {0,13:F3} +- {1,9:F3}", d.dcl_total_u235.v, d.dcl_total_u235.err)
                                    }));
                                    listView1.Items.Add(new ListViewItem(new string[] {
                                        string.Format("Declared - assay U235 mass: {0,13:F3} +- {1,9:F3} or {2,6:F2}%",
                                                      d.dcl_minus_asy_u235_mass.v, d.dcl_minus_asy_u235_mass.err, d.dcl_minus_asy_u235_mass_pct)
                                    }));
                                }
                            }
                        }
                    }
                    break;

                case AssaySelector.MeasurementOption.unspecified:
                    listView1.Items.Add(new ListViewItem(new string[] { "List mode results" + augmenter }));
                    listView1.Items.Add(new ListViewItem(new string[] { "TODO " }));     // todo: fill in with something useful for LM
                    break;
                }
            }
        }
Exemple #23
0
    private void LoadTestGUI()
    {
        int num = -1;

        num++;
        this.resName = GUI.TextField(new Rect(100f, 20f, 300f, 30f), this.resName);
        num         += 5;
        if (GUI.Button(this.GetRect(num), "unload asset"))
        {
            AssetBundleLoader.Instance.Initialize(null);
            Debug.LogError("begin " + Time.get_time());
            AssetBundleLoader.Instance.UnloadAB(this.resName, delegate(bool isOK)
            {
                Debug.LogError("done " + Time.get_time());
            }, null);
        }
        num++;
        if (GUI.Button(this.GetRect(num), "load asset"))
        {
            AssetBundleLoader.Instance.Initialize(null);
            Debug.LogError("begin " + Time.get_time());
            AssetBundleLoader.Instance.AsyncLoadAB(this.resName, delegate(bool isOK)
            {
                Debug.LogError("done " + Time.get_time());
            }, null);
        }
        num++;
        if (GUI.Button(this.GetRect(num), "print all"))
        {
            List <string> list = new List <string>();
            using (Dictionary <string, Object> .Enumerator enumerator = AssetBundleLoader.Instance.m_alreadyLoaded.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <string, Object> current = enumerator.get_Current();
                    list.Add(current.get_Key());
                }
            }
            Debug.LogError("==>[print all]");
            list.Sort();
            using (List <string> .Enumerator enumerator2 = list.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    string current2 = enumerator2.get_Current();
                    Debug.LogError(current2);
                }
            }
        }
        num++;
        if (GUI.Button(this.GetRect(num), "ref stack"))
        {
            Debug.LogError("==>[ref stack]");
            AssetBundleLoader.Instance.OutputStackTrace(this.resName);
        }
        num++;
        if (GUI.Button(this.GetRect(num), "load jni"))
        {
            Debug.LogError("==>[load jni]");
            Debug.LogError(NativeCallManager.ContainsInAssets(string.Empty, "abmap.txt"));
            Debug.LogError(Encoding.get_UTF8().GetString(NativeCallManager.getFromAssets("abmap.txt")));
        }
        num++;
        if (GUI.Button(this.GetRect(num), "test shader"))
        {
            Debug.LogError("==>[test shader]");
            ShaderManager.BeginInit(delegate
            {
                for (int i = 0; i < ShaderManager.Instance.listShader.Length; i++)
                {
                    Debug.LogError(string.Concat(new object[]
                    {
                        "index = ",
                        i,
                        ", shader = ",
                        ShaderManager.Instance.listShader[i].get_name()
                    }));
                }
                for (int j = 0; j < ShaderManager.Instance.listShader.Length; j++)
                {
                    if (!ShaderManager.Instance.listShader[j].get_isSupported())
                    {
                        Debug.LogError("index = " + j + ", shader no supported");
                    }
                }
            });
        }
        num++;
        if (GUI.Button(this.GetRect(num), "test shader now"))
        {
            Debug.LogError("==>[test shader now]");
            Object @object = AssetManager.AssetOfNoPool.LoadAssetNowNoAB(FileSystem.GetPath("Shader", string.Empty), typeof(Object));
            if (@object != null)
            {
                Debug.LogError("shader asset not null");
            }
            else
            {
                Debug.LogError("shader asset is null");
            }
        }
    }
Exemple #24
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            // Create the main window
            RenderWindow App = new RenderWindow(new VideoMode(800, 600), "SFML.Net PostFX");

            // Setup event handlers
            App.Closed     += new EventHandler(OnClosed);
            App.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);

            // Check that the system can use post effects
            if (PostFx.CanUsePostFX == false)
            {
                DisplayError(App);
                return;
            }

            // Load a cute background image to display :)
            Sprite Background = new Sprite(new Image("datas/post-fx/background.jpg"));

            // Load the text font
            Font Cheeseburger = new Font("datas/post-fx/cheeseburger.ttf");

            // Load the image needed for the wave effect
            Image WaveImage = new Image("datas/post-fx/wave.jpg");

            // Load all effects
            Effects = new Dictionary<string, PostFx>();
            Effects["nothing"]  = new PostFx("datas/post-fx/nothing.sfx");
            Effects["blur"]     = new PostFx("datas/post-fx/blur.sfx");
            Effects["colorize"] = new PostFx("datas/post-fx/colorize.sfx");
            Effects["fisheye"]  = new PostFx("datas/post-fx/fisheye.sfx");
            Effects["wave"]     = new PostFx("datas/post-fx/wave.sfx");
            CurrentEffect = Effects.GetEnumerator();
            CurrentEffect.MoveNext();

            // Do specific initializations
            Effects["nothing"].SetTexture("framebuffer", null);
            Effects["blur"].SetTexture("framebuffer", null);
            Effects["blur"].SetParameter("offset", 0.0F);
            Effects["colorize"].SetTexture("framebuffer", null);
            Effects["colorize"].SetParameter("color", 1.0F, 1.0F, 1.0F);
            Effects["fisheye"].SetTexture("framebuffer", null);
            Effects["wave"].SetTexture("framebuffer", null);
            Effects["wave"].SetTexture("wave", WaveImage);

            // Define a string for displaying current effect description
            CurFXStr = new String2D();
            CurFXStr.Text = "Current effect is \"" + CurrentEffect.Current.Key + "\"";
            CurFXStr.Font = Cheeseburger;
            CurFXStr.Position = new Vector2(20.0F, 0.0F);

            // Define a string for displaying help
            String2D InfoStr = new String2D();
            InfoStr.Text = "Move your mouse to change the effect parameters\nPress numpad + to change effect\nWarning : some effects may not work\ndepending on your graphics card";
            InfoStr.Font = Cheeseburger;
            InfoStr.Position = new Vector2(20.0F, 460.0F);
            InfoStr.Color = new Color(200, 100, 150);

            // Start the game loop
            while (App.IsOpened())
            {
                // Process events
                App.DispatchEvents();

                // Get the mouse position in the range [0, 1]
                float X = App.Input.GetMouseX() / (float)App.Width;
                float Y = App.Input.GetMouseY() / (float)App.Height;

                // Update the current effect
                if      (CurrentEffect.Current.Key == "blur")     CurrentEffect.Current.Value.SetParameter("offset", X * Y * 0.1f);
                else if (CurrentEffect.Current.Key == "colorize") CurrentEffect.Current.Value.SetParameter("color", 0.3f, X, Y);
                else if (CurrentEffect.Current.Key == "fisheye")  CurrentEffect.Current.Value.SetParameter("mouse", X, 1.0F - Y);
                else if (CurrentEffect.Current.Key == "wave")     CurrentEffect.Current.Value.SetParameter("offset", X, Y);

                // Clear the window
                App.Clear();

                // Draw background and apply the post-fx
                App.Draw(Background);
                App.Draw(CurrentEffect.Current.Value);

                // Draw interface strings
                App.Draw(CurFXStr);
                App.Draw(InfoStr);

                // Finally, display the rendered frame on screen
                App.Display();
            }
        }
Exemple #25
0
        internal void SetTroop(Troop troop)
        {
            bool leader;

            this.ShowingTroop       = troop;
            this.TroopNameText.Text = troop.DisplayName;
            List <LabelText> .Enumerator enumerator = this.LabelTexts.GetEnumerator();
            try
            {
                while (true)
                {
                    leader = enumerator.MoveNext();
                    if (!leader)
                    {
                        break;
                    }
                    LabelText current = enumerator.Current;
                    current.Text.Text = StaticMethods.GetPropertyValue(troop, current.PropertyName).ToString();
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            this.OtherPersonText.AddText("其他人物", this.OtherPersonText.TitleColor);
            this.OtherPersonText.AddNewLine();
            int personCount = troop.PersonCount - 1;

            this.OtherPersonText.AddText(string.Concat(personCount.ToString(), "人"), this.OtherPersonText.SubTitleColor);
            this.OtherPersonText.AddNewLine();
            IEnumerator enumerator1 = troop.Persons.GetEnumerator();

            try
            {
                while (true)
                {
                    leader = enumerator1.MoveNext();
                    if (!leader)
                    {
                        break;
                    }
                    Person person = (Person)enumerator1.Current;
                    leader = person != troop.Leader;
                    if (leader)
                    {
                        this.OtherPersonText.AddText(person.Name);
                        this.OtherPersonText.AddNewLine();
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator1 as IDisposable;
                leader = disposable == null;
                if (!leader)
                {
                    disposable.Dispose();
                }
            }
            this.OtherPersonText.ResortTexts();
            this.CombatMethodText.AddText("部队战法", this.CombatMethodText.TitleColor);
            this.CombatMethodText.AddNewLine();
            personCount = troop.CombatMethods.Count;
            this.CombatMethodText.AddText(string.Concat(personCount.ToString(), "种"), this.CombatMethodText.SubTitleColor);
            this.CombatMethodText.AddNewLine();
            Dictionary <int, CombatMethod> .ValueCollection.Enumerator enumerator2 = troop.CombatMethods.CombatMethods.Values.GetEnumerator();
            try
            {
                while (true)
                {
                    leader = enumerator2.MoveNext();
                    if (!leader)
                    {
                        break;
                    }
                    CombatMethod combatMethod = enumerator2.Current;
                    this.CombatMethodText.AddText(combatMethod.Name, this.CombatMethodText.SubTitleColor2);
                    personCount = combatMethod.Combativity - troop.DecrementOfCombatMethodCombativityConsuming;
                    this.CombatMethodText.AddText(string.Concat(" 战意消耗", personCount.ToString()), this.CombatMethodText.SubTitleColor3);
                    this.CombatMethodText.AddNewLine();
                }
            }
            finally
            {
                enumerator2.Dispose();
            }
            this.CombatMethodText.ResortTexts();
            this.StuntText.AddText("部队特技", this.StuntText.TitleColor);
            this.StuntText.AddNewLine();
            personCount = troop.Stunts.Count;
            this.StuntText.AddText(string.Concat(personCount.ToString(), "种"), this.StuntText.SubTitleColor);
            this.StuntText.AddNewLine();
            Dictionary <int, Stunt> .ValueCollection.Enumerator enumerator3 = troop.Stunts.Stunts.Values.GetEnumerator();
            try
            {
                while (true)
                {
                    leader = enumerator3.MoveNext();
                    if (!leader)
                    {
                        break;
                    }
                    Stunt stunt = enumerator3.Current;
                    this.StuntText.AddText(stunt.Name, this.StuntText.SubTitleColor2);
                    personCount = stunt.Combativity;
                    this.StuntText.AddText(string.Concat(" 战意消耗", personCount.ToString()), this.StuntText.SubTitleColor3);
                    this.StuntText.AddNewLine();
                }
            }
            finally
            {
                enumerator3.Dispose();
            }
            this.StuntText.ResortTexts();
            this.InfluenceText.AddText("部队特性", this.InfluenceText.TitleColor);
            this.InfluenceText.AddNewLine();
            this.InfluenceText.AddText(this.ShowingTroop.Army.Kind.Name, this.InfluenceText.SubTitleColor);
            this.InfluenceText.AddNewLine();
            Dictionary <int, Influence> .ValueCollection.Enumerator enumerator4 = this.ShowingTroop.Army.Kind.Influences.Influences.Values.GetEnumerator();
            try
            {
                while (true)
                {
                    leader = enumerator4.MoveNext();
                    if (!leader)
                    {
                        break;
                    }
                    Influence influence = enumerator4.Current;
                    this.InfluenceText.AddText(influence.Name, this.InfluenceText.SubTitleColor2);
                    this.InfluenceText.AddText(influence.Description, this.InfluenceText.SubTitleColor3);
                    this.InfluenceText.AddNewLine();
                }
            }
            finally
            {
                enumerator4.Dispose();
            }
            this.InfluenceText.ResortTexts();
        }
Exemple #26
0
        // Token: 0x06000EED RID: 3821 RVA: 0x00039E88 File Offset: 0x00038088
        private void WriteNotification(bool asyncOperation, double throttleInterval, IPendingRequestNotifier notifier, PendingRequestManager.PendingNotifierState notifierState)
        {
            bool flag = false;

            if (notifier.ShouldThrottle)
            {
                int num = notifierState.IncrementOnDataAvailableThrottleCount();
                if (num > 100)
                {
                    flag = true;
                }
                else if (num == 100 && throttleInterval <= 10.0)
                {
                    ExTraceGlobals.NotificationsCallTracer.TraceDebug <string, int>((long)this.GetHashCode(), "Start throttling mechanism - timer was started and from now on notifier {0} / {1} will be on throttling mode ", notifier.GetType().Name, notifier.GetHashCode());
                    flag = true;
                    if (notifierState.ThrottleTimer == null)
                    {
                        notifierState.ThrottleTimer = new Timer(new TimerCallback(this.ThrottleTimeout), notifier, 20000, -1);
                    }
                    else
                    {
                        notifierState.ThrottleTimer.Change(20000, -1);
                    }
                }
                if (num <= 100 && throttleInterval > 10.0 && num != 1)
                {
                    notifierState.ExchangeOnDataAvailableThrottleCount(1);
                }
            }
            if (flag)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceDebug <string, int>((long)this.GetHashCode(), "PendingRequestManager.WriteNotification throttled notifier: {0} / {1}", notifier.GetType().Name, notifier.GetHashCode());
                return;
            }
            ExTraceGlobals.NotificationsCallTracer.TraceDebug <string, int>((long)this.GetHashCode(), "PendingRequestManager.WriteNotification is reading data from the notifier. Notifier: {0} / {1}", notifier.GetType().Name, notifier.GetHashCode());
            try
            {
                List <NotificationPayloadBase> payloadList = (List <NotificationPayloadBase>)notifier.ReadDataAndResetState();
                if (notifier.SubscriptionId != null)
                {
                    Pusher.Instance.Distribute(payloadList, notifier.ContextKey, notifier.SubscriptionId);
                }
                if (this.pendingRequestChannels != null)
                {
                    lock (this.pendingRequestChannels)
                    {
                        if (this.pendingRequestChannels != null)
                        {
                            if (this.budget == null)
                            {
                                this.budget = StandardBudget.Acquire(this.userContext.ExchangePrincipal.Sid, BudgetType.Owa, this.userContext.ExchangePrincipal.MailboxInfo.OrganizationId.ToADSessionSettings());
                            }
                            this.budget.CheckOverBudget();
                            this.budget.StartLocal("PendingRequestManager.WriteNotification", default(TimeSpan));
                            try
                            {
                                using (Dictionary <string, PendingRequestChannel> .Enumerator enumerator = this.pendingRequestChannels.GetEnumerator())
                                {
                                    while (enumerator.MoveNext())
                                    {
                                        KeyValuePair <string, PendingRequestChannel> channel = enumerator.Current;
                                        try
                                        {
                                            OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate()
                                            {
                                                KeyValuePair <string, PendingRequestChannel> channel = channel;
                                                channel.Value.WritePayload(asyncOperation, payloadList);
                                                Dictionary <string, long> dictionary = this.channelNotificationMarks;
                                                KeyValuePair <string, PendingRequestChannel> channel2 = channel;
                                                if (dictionary.ContainsKey(channel2.Key))
                                                {
                                                    Dictionary <string, long> dictionary3;
                                                    Dictionary <string, long> dictionary2 = dictionary3 = this.channelNotificationMarks;
                                                    KeyValuePair <string, PendingRequestChannel> channel3 = channel;
                                                    string key;
                                                    dictionary2[key = channel3.Key] = dictionary3[key] + (long)payloadList.Count;
                                                    return;
                                                }
                                                Dictionary <string, long> dictionary4 = this.channelNotificationMarks;
                                                KeyValuePair <string, PendingRequestChannel> channel4 = channel;
                                                dictionary4.Add(channel4.Key, (long)payloadList.Count);
                                            });
                                        }
                                        catch (GrayException ex)
                                        {
                                            Exception ex2 = (ex.InnerException != null) ? ex.InnerException : ex;
                                            ExTraceGlobals.NotificationsCallTracer.TraceError((long)this.GetHashCode(), "Exception when writing the notifications to the client. Notifier {0} / {1}, exception message: {2}, stack: {3};", new object[]
                                            {
                                                notifier.GetType().Name,
                                                notifier.GetHashCode(),
                                                ex2.Message,
                                                ex2.StackTrace
                                            });
                                        }
                                    }
                                }
                            }
                            finally
                            {
                                this.budget.EndLocal();
                            }
                        }
                    }
                }
            }
            catch (Exception ex3)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceError <string, int, string>((long)this.GetHashCode(), "Exception when writing the notifications to the client. Notifier {0} / {1}, exception message: {2};", notifier.GetType().Name, notifier.GetHashCode(), (ex3.InnerException != null) ? ex3.InnerException.Message : ex3.Message);
                throw;
            }
        }
        public List <QuestItemGetFmt> ClearItemGet(User_QuestFmt fmt)
        {
            Mem_quest mem_quest = null;

            if (!Comm_UserDatas.Instance.User_quest.TryGetValue(fmt.No, ref mem_quest))
            {
                return(null);
            }
            if (mem_quest.State != QuestState.COMPLETE)
            {
                return(null);
            }
            mem_quest.StateChange(this, QuestState.END);
            Mst_questcount mst_questcount = null;

            if (Mst_DataManager.Instance.Mst_questcount.TryGetValue(mem_quest.Rid, ref mst_questcount))
            {
                using (Dictionary <int, bool> .Enumerator enumerator = mst_questcount.Reset_flag.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        KeyValuePair <int, bool> current = enumerator.get_Current();
                        if (current.get_Value())
                        {
                            Mem_questcount mem_questcount = null;
                            if (Comm_UserDatas.Instance.User_questcount.TryGetValue(current.get_Key(), ref mem_questcount))
                            {
                                mem_questcount.Reset(true);
                            }
                        }
                    }
                }
            }
            Mst_quest mst_quest         = this.mst_quest.get_Item(fmt.No);
            List <QuestItemGetFmt> list = new List <QuestItemGetFmt>();

            using (Dictionary <enumMaterialCategory, int> .Enumerator enumerator2 = fmt.GetMaterial.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    KeyValuePair <enumMaterialCategory, int> current2 = enumerator2.get_Current();
                    if (current2.get_Key() <= enumMaterialCategory.Bauxite)
                    {
                        list.Add(this._ItemGet(current2.get_Key(), current2.get_Value()));
                    }
                }
            }
            int  slotModelChangeId  = mst_quest.GetSlotModelChangeId(1);
            int  slotModelChangeId2 = mst_quest.GetSlotModelChangeId(2);
            bool useCrewFlag        = false;
            bool maxExpFlag         = false;

            if (slotModelChangeId > 0)
            {
                maxExpFlag  = mst_quest.IsLevelMax(this.mst_slotitemchange.get_Item(slotModelChangeId));
                useCrewFlag = mst_quest.IsUseCrew(this.mst_slotitemchange.get_Item(slotModelChangeId));
            }
            list.Add(this._ItemGet(mst_quest.Get_1_type, mst_quest.Get_1_id, mst_quest.Get_1_count, maxExpFlag, useCrewFlag));
            bool useCrewFlag2 = false;
            bool maxExpFlag2  = false;

            if (slotModelChangeId2 > 0)
            {
                maxExpFlag2  = mst_quest.IsLevelMax(this.mst_slotitemchange.get_Item(slotModelChangeId2));
                useCrewFlag2 = mst_quest.IsUseCrew(this.mst_slotitemchange.get_Item(slotModelChangeId2));
            }
            list.Add(this._ItemGet(mst_quest.Get_2_type, mst_quest.Get_2_id, mst_quest.Get_2_count, maxExpFlag2, useCrewFlag2));
            list = list.FindAll((QuestItemGetFmt item) => item != null);
            return(list);
        }
        public bool GetFirst(out KeyValuePair<int, string> item)
        {
            item = new KeyValuePair<int, string>();
            if (playList.Count == 0)
                return false;

            enumerator = playList.GetEnumerator();
            if (enumerator.MoveNext())
            {
                item = enumerator.Current;
                return true;
            }
            else
            {
                return false;
            }
        }
        private void QuestReset()
        {
            List <int>    list    = null;
            HashSet <int> hashSet = null;

            this.setResetType(out list, out hashSet);
            using (Dictionary <int, Mst_quest> .ValueCollection.Enumerator enumerator = this.mst_quest.get_Values().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mst_quest current = enumerator.get_Current();
                    if (current.Type != 1)
                    {
                        Mem_quest mem_quest = null;
                        if (Comm_UserDatas.Instance.User_quest.TryGetValue(current.Id, ref mem_quest))
                        {
                            if (mem_quest.State != QuestState.NOT_DISP && list.Contains(current.Type))
                            {
                                if (current.Torigger == 0)
                                {
                                    mem_quest.StateChange(this, QuestState.WAITING_START);
                                }
                                else
                                {
                                    Mst_quest mst_quest = null;
                                    if (!this.mst_quest.TryGetValue(current.Torigger, ref mst_quest))
                                    {
                                        mem_quest.StateChange(this, QuestState.NOT_DISP);
                                    }
                                    else if (mst_quest.Type != 1)
                                    {
                                        mem_quest.StateChange(this, QuestState.NOT_DISP);
                                    }
                                    else
                                    {
                                        mem_quest.StateChange(this, QuestState.WAITING_START);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            using (HashSet <int> .Enumerator enumerator2 = hashSet.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    int        current2 = enumerator2.get_Current();
                    List <int> list2    = this.mst_quest_reset.get_Item(current2);
                    using (List <int> .Enumerator enumerator3 = list2.GetEnumerator())
                    {
                        while (enumerator3.MoveNext())
                        {
                            int            current3       = enumerator3.get_Current();
                            Mem_questcount mem_questcount = null;
                            if (Comm_UserDatas.Instance.User_questcount.TryGetValue(current3, ref mem_questcount))
                            {
                                mem_questcount.Reset(true);
                            }
                        }
                    }
                }
            }
        }
Exemple #30
0
    public void ShowSmeltWillReturn(List <long> list_equip_uuid)
    {
        bool flag = EquipGlobal.IsContainHighLevel(list_equip_uuid);

        this.return_list.Clear();
        for (int i = 0; i < list_equip_uuid.get_Count(); i++)
        {
            int key = BackpackManager.Instance.OnGetGoodItemId(list_equip_uuid.get_Item(i));
            zZhuangBeiPeiZhiBiao zZhuangBeiPeiZhiBiao = DataReader <zZhuangBeiPeiZhiBiao> .Get(key);

            for (int j = 0; j < zZhuangBeiPeiZhiBiao.smeltDrop.get_Count(); j++)
            {
                zZhuangBeiPeiZhiBiao.SmeltdropPair smeltdropPair = zZhuangBeiPeiZhiBiao.smeltDrop.get_Item(j);
                if (this.return_list.ContainsKey(smeltdropPair.key))
                {
                    this.return_list.set_Item(smeltdropPair.key, this.return_list.get_Item(smeltdropPair.key) + (long)smeltdropPair.value);
                }
                else
                {
                    this.return_list.set_Item(smeltdropPair.key, (long)smeltdropPair.value);
                }
            }
        }
        string text  = string.Empty;
        string text2 = string.Empty;

        using (Dictionary <int, long> .Enumerator enumerator = this.return_list.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                KeyValuePair <int, long> current = enumerator.get_Current();
                int    num = this.GetMaxFund() - GuildManager.Instance.GetEquipSmeltDayFund();
                string text3;
                if (current.get_Key() == MoneyType.GetItemId(6))
                {
                    if (GuildManager.Instance.GetEquipSmeltDayFund() >= this.GetMaxFund())
                    {
                        text2 = TextColorMgr.GetColorByID("本日军团资金贡献已达最大值\n", 1000007);
                        continue;
                    }
                    if ((long)num < current.get_Value())
                    {
                        string itemName = GameDataUtils.GetItemName(current.get_Key(), true, 0L);
                        text3 = text;
                        text  = string.Concat(new object[]
                        {
                            text3,
                            itemName,
                            "x",
                            num,
                            "\n"
                        });
                        continue;
                    }
                }
                string itemName2 = GameDataUtils.GetItemName(current.get_Key(), true, 0L);
                text3 = text;
                text  = string.Concat(new object[]
                {
                    text3,
                    itemName2,
                    "x",
                    current.get_Value(),
                    "\n"
                });
            }
        }
        text += text2;
        string text4 = string.Empty;

        if (flag)
        {
            text4 = "熔炼后将会获得{0}检测到您选中了高级装备\n是否进行熔炼?";
        }
        else
        {
            text4 = "熔炼后将会获得{0}是否进行熔炼?";
        }
        text4 = string.Format(text4, text);
        DialogBoxUIViewModel.Instance.ShowAsOKCancel("熔炼预览", text4, null, delegate
        {
            Dictionary <int, List <long> > dictionary = new Dictionary <int, List <long> >();
            for (int k = 0; k < list_equip_uuid.get_Count(); k++)
            {
                int key2 = BackpackManager.Instance.OnGetGoodItemId(list_equip_uuid.get_Item(k));
                zZhuangBeiPeiZhiBiao zZhuangBeiPeiZhiBiao2 = DataReader <zZhuangBeiPeiZhiBiao> .Get(key2);
                if (dictionary.ContainsKey(zZhuangBeiPeiZhiBiao2.position))
                {
                    List <long> list = dictionary.get_Item(zZhuangBeiPeiZhiBiao2.position);
                    list.Add(list_equip_uuid.get_Item(k));
                }
                else
                {
                    List <long> list2 = new List <long>();
                    list2.Add(list_equip_uuid.get_Item(k));
                    dictionary.Add(zZhuangBeiPeiZhiBiao2.position, list2);
                }
            }
            List <DecomposeEquipInfo> list3 = new List <DecomposeEquipInfo>();
            using (Dictionary <int, List <long> > .Enumerator enumerator2 = dictionary.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    KeyValuePair <int, List <long> > current2 = enumerator2.get_Current();
                    DecomposeEquipInfo decomposeEquipInfo     = new DecomposeEquipInfo();
                    decomposeEquipInfo.position = current2.get_Key();
                    decomposeEquipInfo.equipIds.AddRange(current2.get_Value());
                    list3.Add(decomposeEquipInfo);
                }
            }
            GuildManager.Instance.SendSmeltEquip(list3);
        }, "取消", "确定", "button_orange_1", "button_yellow_1", null, true, true);
    }
        private void SetEnableList()
        {
            if (Enumerable.Count <int>(this.mst_quest.get_Keys()) != Enumerable.Count <int>(Comm_UserDatas.Instance.User_quest.get_Keys()))
            {
                IEnumerable <int> enumerable = Enumerable.Except <int>(this.mst_quest.get_Keys(), Comm_UserDatas.Instance.User_quest.get_Keys());
                using (IEnumerator <int> enumerator = enumerable.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        int       current   = enumerator.get_Current();
                        int       category  = this.mst_quest.get_Item(current).Category;
                        Mem_quest mem_quest = new Mem_quest(current, category, QuestState.NOT_DISP);
                        Comm_UserDatas.Instance.User_quest.Add(mem_quest.Rid, mem_quest);
                    }
                }
            }
            int num = Comm_UserDatas.Instance.User_turn.GetDateTime().get_Day() % 10;

            using (Dictionary <int, Mem_quest> .ValueCollection.Enumerator enumerator2 = Comm_UserDatas.Instance.User_quest.get_Values().GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    Mem_quest current2 = enumerator2.get_Current();
                    if (this.mst_quest.get_Item(current2.Rid).Type == 4 && num != 0 && num != 3 && num != 7)
                    {
                        current2.StateChange(this, QuestState.NOT_DISP);
                    }
                    else if (this.mst_quest.get_Item(current2.Rid).Type == 5 && num != 2 && num != 8)
                    {
                        current2.StateChange(this, QuestState.NOT_DISP);
                    }
                    else if (current2.State == QuestState.NOT_DISP)
                    {
                        if (this.specialToriggerCheck(this.mst_quest.get_Item(current2.Rid)))
                        {
                            if (this.mst_quest.get_Item(current2.Rid).Sub_torigger != 0)
                            {
                                Mem_quest mem_quest2 = null;
                                if (!Comm_UserDatas.Instance.User_quest.TryGetValue(this.mst_quest.get_Item(current2.Rid).Sub_torigger, ref mem_quest2))
                                {
                                    continue;
                                }
                                if (mem_quest2.State != QuestState.END)
                                {
                                    continue;
                                }
                            }
                            Mem_quest mem_quest3 = null;
                            if (!Comm_UserDatas.Instance.User_quest.TryGetValue(this.mst_quest.get_Item(current2.Rid).Torigger, ref mem_quest3))
                            {
                                if (this.mst_quest.get_Item(current2.Rid).Torigger == 0)
                                {
                                    current2.StateChange(this, QuestState.WAITING_START);
                                }
                            }
                            else if (mem_quest3.State == QuestState.END)
                            {
                                current2.StateChange(this, QuestState.WAITING_START);
                            }
                        }
                    }
                }
            }
        }
Exemple #32
0
 /// <summary>
 /// 迭代下一项
 /// </summary>
 /// <returns></returns>
 public bool MoveNext()
 {
     return(_enumerator.MoveNext());
 }
Exemple #33
0
    /// <summary>
    /// 服务器推送玩家信息,,推送回来的可能只是修改后的玩家信息
    /// </summary>
    /// <param name="p"></param>
    void _Packet(ScMazeScenePlayer p)
    {
        PMazePlayer[] players = null;
        p.playerList.CopyTo(ref players);

        //对玩家进行排序,并重新填充
        List <PMazePlayer> allPlayerList = new List <PMazePlayer>();

        //先填充已有数据
        if (areaPlayerDic != null)
        {
            Dictionary <EnumLabyrinthArea, List <PMazePlayer> > .Enumerator e = areaPlayerDic.GetEnumerator();
            while (e.MoveNext())
            {
                allPlayerList.AddRange(e.Current.Value);
            }
        }

        //再覆盖老数据
        List <PMazePlayer> needAddList = new List <PMazePlayer>();

        for (int i = 0; i < players.Length; i++)
        {
            PMazePlayer pp        = players[i];
            bool        isContain = false;
            for (int j = 0; j < allPlayerList.Count; j++)
            {
                if (pp.roleId == allPlayerList[j].roleId)
                {
                    allPlayerList[j] = pp;
                    isContain        = true;
                    break;
                }
            }

            if (!isContain)
            {
                needAddList.Add(pp);
            }
        }

        //将新增的数据直接填充到列表中
        allPlayerList.AddRange(needAddList);

        //将收到的玩家列表中自己的数据更新
        if (labyrinthSelfInfo != null)
        {
            for (int i = 0; i < allPlayerList.Count; i++)
            {
                if (allPlayerList[i].roleId == modulePlayer.id_)
                {
                    allPlayerList[i].mazeLayer = labyrinthSelfInfo.mazeLayer;
                    break;
                }
            }
        }

        foreach (var item in allPlayerList)
        {
            if (item.fashion == null)
            {
                Logger.LogError("roleId = {0} roleName = {1} fashion data is null", item.roleId, item.roleName);
                if (item.roleId == modulePlayer.id_)
                {
                    item.fashion = GetSelfFashion();
                }
                else
                {
                    item.fashion = GetRandomFashion(item.gender, item.roleProto);
                }
            }
        }

        //协议异常到连自己的信息都没有了
        if (allPlayerList.FindIndex(o => o.roleId == modulePlayer.id_) < 0)
        {
            var se = PacketObject.Create <PMazePlayer>();
            se.roleId        = modulePlayer.id_;
            se.roleName      = modulePlayer.roleInfo.roleName;
            se.roleProto     = (byte)modulePlayer.proto;
            se.gender        = (byte)modulePlayer.gender;
            se.mazeLayer     = m_labyrinthSelfInfo == null ? (byte)0 : m_labyrinthSelfInfo.mazeLayer;
            se.lastMazeLevel = 0;
            se.mazeState     = (byte)EnumLabyrinthPlayerState.Battle;
            se.fashion       = GetSelfFashion();
            if (modulePet.FightingPet != null)
            {
                se.pet = modulePet.FightingPet.Item;
            }
            allPlayerList.Add(se);
        }

        allPlayerList.Sort((a, b) =>
        {
            //层数相同先过关的玩家优先显示
            if (a.mazeLayer == b.mazeLayer)
            {
                return(a.layerTime.CompareTo(b.layerTime));
            }

            return(-a.mazeLayer.CompareTo(b.mazeLayer));
        });

        RefreshAreaPlayers(allPlayerList);
        DispatchModuleEvent(EventRefreshPlayers, areaPlayerDic);
        DispatchModuleEvent(EventCreatePlayers);
    }
    /// <summary>
    /// 过滤字符串,默认遇到敏感词汇就以'*'代替
    /// </summary>
    /// <param name="text"></param>
    /// <param name="mask"></param>
    /// <returns></returns>
    unsafe public static string Filter(string text, string mask = "*")
    {
        Dictionary <int, int> dic = DetectIllegalWords(text);

        ///如果没有敏感词汇,则直接返回出去
        if (dic.Count == 0)
        {
            return(text);

            fixed(char *newText = text, cMask = mask)
            {
                var itor = newText;

                Dictionary <int, int> .Enumerator enumerator = dic.GetEnumerator();
                ///开始替换敏感词汇
                while (enumerator.MoveNext())
                {
                    ///偏移到敏感词出现的位置
                    itor = newText + enumerator.Current.Key;
                    for (int index = 0; index < enumerator.Current.Value; index++)
                    {
                        ///屏蔽掉敏感词汇
                        *itor++ = *cMask;
                    }
                }
                enumerator.Dispose();
            }

            return(text);
    }

    ///// <summary>
    ///// 判断text是否有敏感词汇,如果有返回敏感的词汇的位置,利用指针操作来加快运算速度,暂时独立出一个函数出来,不考虑代码复用的情况
    ///// </summary>
    ///// <param name="text"></param>
    ///// <returns></returns>
    //unsafe public static bool IllegalWordsExistJudgement(string text)
    //{
    //    if (string.IsNullOrEmpty(text))
    //        return false;

    //    fixed (char* ptext = text, detectedStrStart = dectectedBuffer)
    //    {
    //        ///缓存字符串的初始位置
    //        char* itor = (fastCheck[*ptext] & 0x01) == 0 ? ptext + 1 : ptext;
    //        ///缓存字符串的末尾位置
    //        char* end = ptext + text.Length;

    //        while (itor < end)
    //        {
    //            ///如果text的第一个词不是敏感词汇或者当前遍历到了text第一个词的后面的词,则循环检测到text词汇的倒数第二个词,看看这一段子字符串中有没有敏感词汇
    //            if ((fastCheck[*itor] & 0x01) == 0)
    //            {
    //                while (itor < end - 1 && (fastCheck[*(++itor)] & 0x01) == 0) ;
    //            }

    //            ///如果有只有一个词的敏感词,且当前的字符串的“非第一个词”满足这个敏感词,则先加入已检测到的敏感词列表
    //            if (startCache[*itor] != 0 && (fastLength[*itor] & 0x01) > 0)
    //            {
    //                return true;
    //            }

    //            char* strItor = detectedStrStart;
    //            *strItor++ = *itor;
    //            int remainLength = (int)(end - itor - 1);
    //            int skipCount = 0;
    //            ///此时已经检测到一个敏感词的“首词”了,记录下第一个检测到的敏感词的位置
    //            ///从当前的位置检测到字符串末尾
    //            for (int i = 1; i <= remainLength; ++i)
    //            {
    //                char* subItor = itor + i;
    //                /// 跳过一些过滤的字符,比如空格特殊符号之类的
    //                if (SkipBitArray[*subItor])
    //                {
    //                    ++skipCount;
    //                    continue;
    //                }
    //                ///如果检测到当前的词在所有敏感词中的位置信息中没有处在第i位的,则马上跳出遍历
    //                if ((fastCheck[*subItor] >> Math.Min(i - skipCount, 7)) == 0)
    //                {
    //                    break;
    //                }

    //                *strItor++ = *subItor;
    //                ///如果有检测到敏感词的最后一个词,并且此时的“检测到的敏感词汇”的长度也符合要求,则才进一步查看检测到的敏感词汇是否是真的敏感
    //                if ((fastLength[*itor] >> Math.Min(i - 1 - skipCount, 7)) > 0 && endCache[*subItor])
    //                {
    //                    ///如果此子字符串在敏感词字典中存在,则记录。做此判断是避免敏感词中夹杂了其他敏感词的单词,而上面的算法无法剔除,故先用hash数组来剔除
    //                    ///上述算法是用于减少大部分的比较消耗
    //                    if (wordsSet.Contains(new string(dectectedBuffer, 0, (int)(strItor - detectedStrStart))))
    //                    {
    //                        return true;
    //                    }
    //                }
    //                else if (i - skipCount > startCache[*itor] && startCache[*itor] < 0x80)///如果超过了以该词为首的一系列的敏感词汇的最大的长度,则不继续判断(前提是该词对应的所有敏感词汇没有超过8个词的)
    //                {
    //                    break;
    //                }
    //            }
    //            ++itor;
    //        }
    //    }

    //    return false;
    //}

    /// <summary>
    /// 判断text是否有敏感词汇,如果有返回敏感的词汇的位置,利用指针操作来加快运算速度
    /// </summary>
    /// <param name="text"></param>
    /// <returns></returns>
    unsafe public static Dictionary <int, int> DetectIllegalWords(string text)
Exemple #35
0
        IEnumerator DogfightCompetitionModeRoutine(float distance)
        {
            competitionStarting = true;
            competitionStatus   = "Competition: Pilots are taking off.";
            Dictionary <BDArmorySetup.BDATeams, List <BDModulePilotAI> > pilots =
                new Dictionary <BDArmorySetup.BDATeams, List <BDModulePilotAI> >();

            pilots.Add(BDArmorySetup.BDATeams.A, new List <BDModulePilotAI>());
            pilots.Add(BDArmorySetup.BDATeams.B, new List <BDModulePilotAI>());
            List <Vessel> .Enumerator loadedVessels = BDATargetManager.LoadedVessels.GetEnumerator();
            while (loadedVessels.MoveNext())
            {
                if (loadedVessels.Current == null)
                {
                    continue;
                }
                if (!loadedVessels.Current.loaded)
                {
                    continue;
                }
                BDModulePilotAI pilot = null;
                IEnumerator <BDModulePilotAI> ePilots = loadedVessels.Current.FindPartModulesImplementing <BDModulePilotAI>().AsEnumerable().GetEnumerator();
                while (ePilots.MoveNext())
                {
                    pilot = ePilots.Current;
                    break;
                }
                ePilots.Dispose();
                if (!pilot || !pilot.weaponManager)
                {
                    continue;
                }

                pilots[BDATargetManager.BoolToTeam(pilot.weaponManager.team)].Add(pilot);
                pilot.ActivatePilot();
                pilot.standbyMode = false;
                if (pilot.weaponManager.guardMode)
                {
                    pilot.weaponManager.ToggleGuardMode();
                }
            }
            loadedVessels.Dispose();

            //clear target database so pilots don't attack yet
            BDATargetManager.ClearDatabase();

            if (pilots[BDArmorySetup.BDATeams.A].Count == 0 || pilots[BDArmorySetup.BDATeams.B].Count == 0)
            {
                Debug.Log("[BDArmory]: Unable to start competition mode - one or more teams is empty");
                competitionStatus = "Competition: Failed!  One or more teams is empty.";
                yield return(new WaitForSeconds(2));

                competitionStarting = false;
                yield break;
            }

            BDModulePilotAI aLeader = pilots[BDArmorySetup.BDATeams.A][0];
            BDModulePilotAI bLeader = pilots[BDArmorySetup.BDATeams.B][0];

            aLeader.weaponManager.wingCommander.CommandAllFollow();
            bLeader.weaponManager.wingCommander.CommandAllFollow();


            //wait till the leaders are airborne
            while (aLeader && bLeader && (aLeader.vessel.LandedOrSplashed || bLeader.vessel.LandedOrSplashed))
            {
                yield return(null);
            }

            if (!aLeader || !bLeader)
            {
                StopCompetition();
            }

            competitionStatus = "Competition: Sending pilots to start position.";
            Vector3 aDirection =
                Vector3.ProjectOnPlane(aLeader.vessel.CoM - bLeader.vessel.CoM, aLeader.vessel.upAxis).normalized;
            Vector3 bDirection =
                Vector3.ProjectOnPlane(bLeader.vessel.CoM - aLeader.vessel.CoM, bLeader.vessel.upAxis).normalized;

            Vector3 center       = (aLeader.vessel.CoM + bLeader.vessel.CoM) / 2f;
            Vector3 aDestination = center + (aDirection * (distance + 1250f));
            Vector3 bDestination = center + (bDirection * (distance + 1250f));

            aDestination = VectorUtils.WorldPositionToGeoCoords(aDestination, FlightGlobals.currentMainBody);
            bDestination = VectorUtils.WorldPositionToGeoCoords(bDestination, FlightGlobals.currentMainBody);

            aLeader.CommandFlyTo(aDestination);
            bLeader.CommandFlyTo(bDestination);

            Vector3 centerGPS = VectorUtils.WorldPositionToGeoCoords(center, FlightGlobals.currentMainBody);

            //wait till everyone is in position
            bool waiting = true;

            while (waiting)
            {
                waiting = false;

                if (!aLeader || !bLeader)
                {
                    StopCompetition();
                }

                if (Vector3.Distance(aLeader.transform.position, bLeader.transform.position) < distance * 1.95f)
                {
                    waiting = true;
                }
                else
                {
                    Dictionary <BDArmorySetup.BDATeams, List <BDModulePilotAI> > .KeyCollection.Enumerator keys = pilots.Keys.GetEnumerator();
                    while (keys.MoveNext())
                    {
                        List <BDModulePilotAI> .Enumerator ePilots = pilots[keys.Current].GetEnumerator();
                        while (ePilots.MoveNext())
                        {
                            if (ePilots.Current == null)
                            {
                                continue;
                            }
                            if (ePilots.Current.currentCommand != BDModulePilotAI.PilotCommands.Follow ||
                                !((ePilots.Current.vessel.CoM - ePilots.Current.commandLeader.vessel.CoM).sqrMagnitude > 1000f * 1000f))
                            {
                                continue;
                            }
                            competitionStatus = "Competition: Waiting for teams to get in position.";
                            waiting           = true;
                        }
                        ePilots.Dispose();
                    }
                    keys.Dispose();
                }

                yield return(null);
            }

            //start the match
            Dictionary <BDArmorySetup.BDATeams, List <BDModulePilotAI> > .KeyCollection.Enumerator pKeys = pilots.Keys.GetEnumerator();
            while (pKeys.MoveNext())
            {
                List <BDModulePilotAI> .Enumerator pPilots = pilots[pKeys.Current].GetEnumerator();
                while (pPilots.MoveNext())
                {
                    if (pPilots.Current == null)
                    {
                        continue;
                    }

                    //enable guard mode
                    if (!pPilots.Current.weaponManager.guardMode)
                    {
                        pPilots.Current.weaponManager.ToggleGuardMode();
                    }

                    //report all vessels
                    if (BDATargetManager.BoolToTeam(pPilots.Current.weaponManager.team) == BDArmorySetup.BDATeams.B)
                    {
                        BDATargetManager.ReportVessel(pPilots.Current.vessel, aLeader.weaponManager);
                    }
                    else
                    {
                        BDATargetManager.ReportVessel(pPilots.Current.vessel, bLeader.weaponManager);
                    }

                    //release command
                    pPilots.Current.ReleaseCommand();
                    pPilots.Current.defaultOrbitCoords = centerGPS;
                }
            }
            pKeys.Dispose();
            competitionStatus = "Competition starting!  Good luck!";
            yield return(new WaitForSeconds(2));

            competitionStarting = false;
        }
    void InitMassSprings()
    {
        int i, j, k, w;

        // 连通区域判定
        Bounds bounds         = deformingMesh.bounds;
        int    xNum           = Mathf.CeilToInt(bounds.extents.x / kConnectAreaSize) * 2;
        int    yNum           = Mathf.CeilToInt(bounds.extents.y / kConnectAreaSize) * 2;
        int    zNum           = Mathf.CeilToInt(bounds.extents.z / kConnectAreaSize) * 2;
        float  sphereSize     = kConnectAreaSize * transform.lossyScale.x;
        float  sphereSizeHalf = sphereSize / 2f;

        bool [,,] spheres = new bool[xNum, yNum, zNum];
        Dictionary <int, Vector3> dicSpheres = new Dictionary <int, Vector3> ();

        for (i = 0; i < xNum; i++)
        {
            for (j = 0; j < yNum; j++)
            {
                for (k = 0; k < zNum; k++)
                {
                    Vector3 localpos = bounds.min + new Vector3(i, j, k) * kConnectAreaSize;
                    Vector3 pos      = transform.TransformPoint(localpos);

                    if (Physics.CheckSphere(pos, sphereSizeHalf / 2))
                    {
                        /*
                         * GameObject go = GameObject.CreatePrimitive (PrimitiveType.Sphere);
                         * Destroy (go.GetComponent<SphereCollider> ());
                         * go.transform.localRotation = Quaternion.identity;
                         * go.transform.localScale = new Vector3(sphereSize, sphereSize, sphereSize);
                         * go.transform.position = pos;
                         */

                        spheres [i, j, k] = true;
                        dicSpheres.Add(i << 20 | j << 10 | k, localpos);
                    }
                }
            }
        }


        Dictionary <int, List <int> > dicSphere2Vertices = new Dictionary <int, List <int> > ();

        for (i = 0; i < originalVertices.Length; i++)
        {
            Vector3 v = originalVertices[i];

            Dictionary <int, Vector3> .Enumerator it = dicSpheres.GetEnumerator();
            bool bFound = false;
            while (it.MoveNext())
            {
                int     id  = it.Current.Key;
                Vector3 pos = it.Current.Value;

                Vector3 offset = v - pos;
                if (offset.magnitude <= kConnectAreaSize)
                {
                    if (!dicSphere2Vertices.ContainsKey(id))
                    {
                        dicSphere2Vertices.Add(id, new List <int>());
                    }
                    dicSphere2Vertices [id].Add(i);
                    bFound = true;
                    break;
                }
            }

            UnityEngine.Debug.Assert(bFound, "vertex not in area " + i);
        }

        // 依次查找最近连通区域 plane-z
        for (i = 0; i < xNum; i++)
        {
            for (j = 0; j < yNum; j++)
            {
                for (k = 0; k < zNum; k++)
                {
                    // 无连通
                    if (!spheres[i, j, k])
                    {
                        continue;
                    }

                    // 连通区域无质点
                    int id = i << 20 | j << 10 | k;
                    if (!dicSphere2Vertices.ContainsKey(id))
                    {
                        continue;
                    }

                    // 查找相连的质点
                    for (w = k + 1; w < zNum; w++)
                    {
                        if (!spheres [i, j, w])
                        {
                            break;
                        }

                        int id2 = i << 20 | j << 10 | w;
                        if (!dicSphere2Vertices.ContainsKey(id2))
                        {
                            continue;
                        }

                        // 找到相连质点区域
                        k = w + 1;
                        UnityEngine.Debug.LogFormat("Found {0} {1}", id, id2);
                        break;
                    }
                }
            }
        }

        // 依次查找最近连通区域 plane-y
        for (j = 0; j < yNum; j++)
        {
            for (k = 0; k < zNum; k++)
            {
                for (i = 0; i < xNum; i++)
                {
                    // 无连通
                    if (!spheres[i, j, k])
                    {
                        continue;
                    }

                    // 连通区域无质点
                    int id = i << 20 | j << 10 | k;
                    if (!dicSphere2Vertices.ContainsKey(id))
                    {
                        continue;
                    }

                    // 查找相连的质点
                    for (w = i + 1; w < xNum; w++)
                    {
                        if (!spheres [w, j, k])
                        {
                            break;
                        }

                        int id2 = w << 20 | j << 10 | k;
                        if (!dicSphere2Vertices.ContainsKey(id2))
                        {
                            continue;
                        }

                        // 找到相连质点区域
                        i = w + 1;
                        UnityEngine.Debug.LogFormat("Found {0} {1}", id, id2);
                        break;
                    }
                }
            }
        }

        // 依次查找最近连通区域 plane-x
        for (i = 0; i < xNum; i++)
        {
            for (k = 0; k < zNum; k++)
            {
                for (j = 0; j < yNum; j++)
                {
                    // 无连通
                    if (!spheres[i, j, k])
                    {
                        continue;
                    }

                    // 连通区域无质点
                    int id = i << 20 | j << 10 | k;
                    if (!dicSphere2Vertices.ContainsKey(id))
                    {
                        continue;
                    }

                    // 查找相连的质点
                    for (w = j + 1; w < yNum; w++)
                    {
                        if (!spheres [i, w, k])
                        {
                            break;
                        }

                        int id2 = i << 20 | w << 10 | k;
                        if (!dicSphere2Vertices.ContainsKey(id2))
                        {
                            continue;
                        }

                        // 找到相连质点区域
                        UnityEngine.Debug.LogFormat("Found {0} {1}", id, id2);
                        j = w + 1;
                        break;
                    }
                }
            }
        }


        // 质点弹簧初始化
        int[] triangles = deformingMesh.triangles;
        for (i = 0; i < triangles.Length / 3; i++)
        {
            int     vidx1 = triangles [i * 3];
            int     vidx2 = triangles [i * 3 + 1];
            int     vidx3 = triangles [i * 3 + 2];
            Vector3 v1    = originalVertices [vidx1];
            Vector3 v2    = originalVertices [vidx2];
            Vector3 v3    = originalVertices [vidx3];
            float   dst12 = (v2 - v1).magnitude;
            float   dst13 = (v3 - v1).magnitude;
            float   dst23 = (v3 - v2).magnitude;

            if (!MassSprings.ContainsKey(vidx1))
            {
                MassSprings.Add(vidx1, new Dictionary <int, float> ());
            }
            if (!MassSprings.ContainsKey(vidx2))
            {
                MassSprings.Add(vidx2, new Dictionary <int, float> ());
            }
            if (!MassSprings.ContainsKey(vidx3))
            {
                MassSprings.Add(vidx3, new Dictionary <int, float> ());
            }
            if (!MassSprings[vidx1].ContainsKey(vidx2))
            {
                MassSprings[vidx1].Add(vidx2, dst12);
            }
            if (!MassSprings[vidx1].ContainsKey(vidx3))
            {
                MassSprings[vidx1].Add(vidx3, dst13);
            }
            if (!MassSprings[vidx2].ContainsKey(vidx1))
            {
                MassSprings[vidx2].Add(vidx1, dst12);
            }
            if (!MassSprings[vidx2].ContainsKey(vidx3))
            {
                MassSprings[vidx2].Add(vidx3, dst23);
            }
            if (!MassSprings[vidx3].ContainsKey(vidx1))
            {
                MassSprings[vidx3].Add(vidx1, dst13);
            }
            if (!MassSprings[vidx3].ContainsKey(vidx2))
            {
                MassSprings[vidx3].Add(vidx2, dst23);
            }
        }

        // 同一连通区域的质点
        Dictionary <int, List <int> > .Enumerator iter = dicSphere2Vertices.GetEnumerator();
        while (iter.MoveNext())
        {
            int        id   = iter.Current.Key;
            List <int> list = iter.Current.Value;

            for (i = 0; i < list.Count; i++)
            {
                int vid1 = list [i];
                for (j = i + 1; j < list.Count; j++)
                {
                    int vid2 = list [j];
                    if (!MassSprings [vid1].ContainsKey(vid2))
                    {
                        float dist = (originalVertices [vid1] - originalVertices [vid2]).magnitude;
                        MassSprings[vid1].Add(vid2, dist);
                        MassSprings[vid2].Add(vid1, dist);
                    }
                }
            }
        }
    }
        public void setPhase(int phaseNum)
        {
            _inController = true;

            TimeSpan totalTime = TimeSpan.Zero;

            _phase = phaseNum;

            if (phases.ContainsKey(_phase))
            {

                phases[_phase].phaseStarted = DateTime.Now + phases[_phase].phaseStartDelay;

                if (phases[_phase].rotationAbilities.Any())
                {
                    nextRotationEnumerator = phases[_phase].rotationAbilitiesWarningTime.GetEnumerator();
                    nextRotationEnumerator.MoveNext();

                    nextRotationTime = phases[_phase].phaseStarted + nextRotationEnumerator.Current.Key;
                    nextRotationAbility = nextRotationEnumerator.Current.Value;


                    totalTime = phases[_phase].rotationAbilities.Last().Key;
                }

                phases[_phase].phaseLength = totalTime;

                if (phases[_phase].onPhaseStart != null)
                {
                    phases[_phase].onPhaseStart.start();
                }

            }

            _inController = false;
        }
Exemple #38
0
    public void Draw(CUIFormScript form)
    {
        if (form == null)
        {
            return;
        }
        GameObject widget = form.GetWidget(9);

        if (widget == null)
        {
            return;
        }
        Utility.FindChild(widget, "pnlHonorInfo").CustomSetActive(true);
        GameObject gameObject = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/HonorList");

        if (gameObject == null)
        {
            return;
        }
        CUIListScript component = gameObject.GetComponent <CUIListScript>();

        if (component == null)
        {
            return;
        }
        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Player_Info_Honor_Item_Enable, new CUIEventManager.OnUIEventHandler(this.OnHonorItemEnable));

        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Player_Info_Honor_Select_Change, new CUIEventManager.OnUIEventHandler(this.OnHonorSelectChange));

        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Player_Info_Honor_Chosen, new CUIEventManager.OnUIEventHandler(this.OnHonorChosen));

        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Player_Info_Honor_Item_Enable, new CUIEventManager.OnUIEventHandler(this.OnHonorItemEnable));

        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Player_Info_Honor_Select_Change, new CUIEventManager.OnUIEventHandler(this.OnHonorSelectChange));

        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Player_Info_Honor_Chosen, new CUIEventManager.OnUIEventHandler(this.OnHonorChosen));

        this.m_honorInfoList.Clear();
        CPlayerProfile profile = Singleton <CPlayerInfoSystem> .GetInstance().GetProfile();

        Dictionary <int, COMDT_HONORINFO> honorDic = profile.GetHonorDic();
        int selectedHonorId = profile.GetSelectedHonorId();

        Dictionary <int, COMDT_HONORINFO> .Enumerator enumerator = honorDic.GetEnumerator();
        while (enumerator.MoveNext())
        {
            KeyValuePair <int, COMDT_HONORINFO> current = enumerator.get_Current();
            COMDT_HONORINFO value = current.get_Value();
            if (value != null)
            {
                this.m_honorInfoList.Add(value);
            }
        }
        if (this.m_honorInfoList != null)
        {
            this.m_honorInfoList.Sort(delegate(COMDT_HONORINFO l, COMDT_HONORINFO r)
            {
                if (l == null)
                {
                    return(1);
                }
                if (r == null)
                {
                    return(-1);
                }
                return(l.iHonorID.CompareTo(r.iHonorID));
            });
        }
        component.SetElementAmount(this.m_honorInfoList.get_Count());
        component.SelectElement(-1, false);
        COMDT_HONORINFO honorInfo = null;

        honorDic.TryGetValue(selectedHonorId, ref honorInfo);
        this.UpdateSelectedHonor(form, honorInfo);
    }
Exemple #39
0
 // Constructor
 public ShaderSelector(Dictionary<string, Shader> owner)
 {
     myOwner = owner;
     myIterator = owner.GetEnumerator();
     myIterator.MoveNext();
 }
Exemple #40
0
 /// <summary>
 /// Function called when a key is pressed
 /// </summary>
 static void OnKeyPressed(object sender, KeyEventArgs e)
 {
     RenderWindow window = (RenderWindow)sender;
     if (e.Code == KeyCode.Escape)
     {
         // Close the window
         window.Close();
     }
     else if (e.Code == KeyCode.Add)
     {
         // Advance to the next effect
         if (CurrentEffect.MoveNext() == false)
         {
             CurrentEffect = Effects.GetEnumerator();
             CurrentEffect.MoveNext();
         }
         CurFXStr.Text = "Current effect is \"" + CurrentEffect.Current.Key + "\"";
     }
 }
Exemple #41
0
    public static List <Units> findTargets(Units self, Vector3 pos, SkillTargetCamp targetType, global::TargetTag targetTag, EffectiveRangeType rangeType, float param1 = 0f, float param2 = 0f, int max_num = -1)
    {
        List <Units> list    = new List <Units>();
        List <int>   targets = null;

        switch (targetType)
        {
        case SkillTargetCamp.Self:
            list.Add(self);
            break;

        case SkillTargetCamp.Enemy:
            targets = TeamManager.GetOtherTeam(self.team, Relation.Hostility, true);
            break;

        case SkillTargetCamp.Partener:
            targets = TeamManager.GetOtherTeam(self.team, Relation.Friendly, true);
            break;

        case SkillTargetCamp.AttackYouTarget:
        {
            Units attackedYouTarget = self.GetAttackedYouTarget();
            if (attackedYouTarget != null)
            {
                list.Add(attackedYouTarget);
            }
            targets = TeamManager.GetOtherTeam(self.team, Relation.Hostility, true);
            break;
        }

        case SkillTargetCamp.SkillHitTarget:
        {
            Units skillHitedTarget = self.GetSkillHitedTarget();
            if (skillHitedTarget != null)
            {
                list.Add(skillHitedTarget);
            }
            return(list);
        }

        case SkillTargetCamp.AttackTarget:
        {
            Units attackTarget = self.GetAttackTarget();
            if (attackTarget != null)
            {
                list.Add(attackTarget);
            }
            targets = TeamManager.GetOtherTeam(self.team, Relation.Hostility, true);
            break;
        }

        case SkillTargetCamp.SkillHitYouTarget:
        {
            Units skillHitedYouTarget = self.GetSkillHitedYouTarget();
            if (skillHitedYouTarget != null)
            {
                list.Add(skillHitedYouTarget);
            }
            return(list);
        }

        case SkillTargetCamp.SelectTarget:
            if (self.currentSkillOrAttack != null)
            {
                return(self.currentSkillOrAttack.attackTargets);
            }
            return(list);
        }
        if (list.Count <= 0)
        {
            switch (rangeType)
            {
            case EffectiveRangeType.JuXing:
            case EffectiveRangeType.YuanXing:
            case EffectiveRangeType.ShanXing:
            case EffectiveRangeType.Single:
            {
                float      radius    = (param1 <= param2) ? param2 : param1;
                int        layerMask = 1 << LayerMask.NameToLayer("Vehicle");
                Collider[] array     = Physics.OverlapSphere(pos, radius, layerMask);
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i] != null)
                    {
                        Collider   collider   = array[i];
                        GameObject gameObject = collider.transform.parent.gameObject;
                        Units      component  = gameObject.GetComponent <Units>();
                        if (max_num == -1 || list.Count < max_num)
                        {
                            if (TagManager.CheckTag(component, targetTag))
                            {
                                if (UnitFeature.TargetInRange(collider.transform.position, rangeType, pos, self.transform.eulerAngles, param1, param2))
                                {
                                    if (TeamManager.CheckTeam(self.gameObject, gameObject, targetType, null))
                                    {
                                        if (!(component == null) && component.isLive && component.CanSkillSelected)
                                        {
                                            if (!list.Contains(component))
                                            {
                                                list.Add(component);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            }

            case EffectiveRangeType.AllMap:
            {
                Dictionary <int, Units>             allMapUnits = MapManager.Instance.GetAllMapUnits();
                Dictionary <int, Units> .Enumerator enumerator  = allMapUnits.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    KeyValuePair <int, Units> current = enumerator.Current;
                    Units value = current.Value;
                    if (!(value == null) && value.isLive && value.CanSkillSelected)
                    {
                        if (max_num == -1 || list.Count < max_num)
                        {
                            if (TagManager.CheckTag(value, targetTag))
                            {
                                if (TeamManager.CheckTeamType(value.teamType, targets))
                                {
                                    if (!list.Contains(value))
                                    {
                                        list.Add(value);
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            }

            case EffectiveRangeType.Link:
            {
                float num        = (param1 <= param2) ? param2 : param1;
                int   layerMask2 = 1 << LayerMask.NameToLayer("Vehicle");
                if (max_num > 0)
                {
                    if (!(self == null))
                    {
                        Units attackTarget2 = self.GetAttackTarget();
                        if (!(attackTarget2 == null))
                        {
                            list.Add(attackTarget2);
                            pos = attackTarget2.transform.position;
                            while (list.Count < max_num)
                            {
                                bool       flag   = false;
                                Units      units  = null;
                                float      num2   = -1f;
                                Collider[] array2 = Physics.OverlapSphere(pos, num, layerMask2);
                                for (int j = 0; j < array2.Length; j++)
                                {
                                    if (array2[j] != null)
                                    {
                                        Collider   collider2   = array2[j];
                                        GameObject gameObject2 = collider2.transform.parent.gameObject;
                                        Units      component2  = gameObject2.GetComponent <Units>();
                                        if (max_num != -1 && list.Count >= max_num)
                                        {
                                            break;
                                        }
                                        if (TagManager.CheckTag(component2, targetTag))
                                        {
                                            if (TeamManager.CheckTeam(self.gameObject, gameObject2, targetType, null))
                                            {
                                                if (!(component2 == null) && component2.isLive && component2.CanSkillSelected)
                                                {
                                                    if (!list.Contains(component2))
                                                    {
                                                        if ((units == null || num2 > (pos - component2.transform.position).sqrMagnitude) && (pos - component2.transform.position).sqrMagnitude < num * num)
                                                        {
                                                            units = component2;
                                                            num2  = (pos - component2.transform.position).sqrMagnitude;
                                                        }
                                                        if (units != null)
                                                        {
                                                            flag = true;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                if (!flag)
                                {
                                    break;
                                }
                                list.Add(units);
                                pos = units.transform.position;
                            }
                        }
                    }
                }
                break;
            }
            }
        }
        return(list);
    }
        private void WriteMatrixCells(XmlNode xmlRoutingNode, Dictionary<KeyValuePair<Guid, Guid>, IRoutingMatrixCell>.Enumerator cellEnumer)
        {
            XmlNode xmlMatrixCellsNode = m_xmlDocument.CreateElement("RoutingMatrixCells");
            xmlRoutingNode.AppendChild(xmlMatrixCellsNode);

            while (cellEnumer.MoveNext())
            {
                WriteMatrixCell(xmlMatrixCellsNode, cellEnumer.Current);
            }
        }
 public void OnGUI()
 {
     scrollPosition = GUI.BeginScrollView(new Rect(0, 0, this.position.width, this.position.height), scrollPosition, new Rect(0, 0, this.position.width - scrollSize, labelsHeigth * (states.Length + 2)));
     //Sensors Label
     GUIStyle styleLabel = new GUIStyle(GUI.skin.label);
     styleLabel.alignment = TextAnchor.MiddleCenter;
     styleLabel.fontStyle = FontStyle.Bold;
     GUI.Label(new Rect(0, 0, this.position.width - scrollSize, labelsHeigth), "Sensors", styleLabel);
     //Sensors list
     sensorsE = sensors.GetEnumerator();
     int numSensor = 0;
     while (sensorsE.MoveNext())
     {
         states[numSensor] = EditorGUI.ToggleLeft(new Rect(0, labelsHeigth * (numSensor + 1), this.position.width - scrollSize, labelsHeigth), "Sensor " + sensorsE.Current.Key + ":", states[numSensor]);
         numSensor++;
     }
     sensorsE = sensors.GetEnumerator();
     //Apply button
     if (GUI.Button(new Rect(0, labelsHeigth * (states.Length + 1), this.position.width - scrollSize, labelsHeigth), "Apply"))
     {
         numSensor = 0;
         while (sensorsE.MoveNext())
         {
             if (states[numSensor])
             {
                 VRPNEditEditor.Instance.EnableTrackerSensor(inFront.dataName, inFront.originalDataTime, inFront.dataDevice, sensorsE.Current.Key);
             }
             else
             {
                 VRPNEditEditor.Instance.DisableTrackerSensor(inFront.dataName, inFront.originalDataTime, inFront.dataDevice, sensorsE.Current.Key);
             }
             numSensor++;
         }
         this.Close();
     }
     GUI.EndScrollView();
 }
        public void PlayFrame()
        {
            if (start)
            {
                keystates[Settings.controls["MoveLeft"]] = false;
                keystates[Settings.controls["MoveRight"]] = false;
                keystates[Settings.controls["Jump"]] = false;
                keystates[Settings.controls["Slide"]] = false;
                keystates[Settings.controls["Box"]] = false;

                time = 0;
                start = false;
                enumerator = events.GetEnumerator();
                enumerator.MoveNext();
            }

            if (enumerator.Current.Key == time)
            {
                foreach (string s in enumerator.Current.Value)
                {
                    string[] split = s.Split(' ');
                    Keys key = Settings.controls[split[1]];
                    keystates[key] = split[0] == "press";
                }

                enumerator.MoveNext();
            }

            if (time % 60 == 0)
            {
                if (recallibrater.Count > time / 60)
                {
                    Game1.currentRoom.Runner.position = recallibrater[time / 60].Item1;
                    Game1.currentRoom.Runner.velocity = recallibrater[time / 60].Item2;
                }
            }

            time++;
        }
Exemple #45
0
        protected override void InternalValidate()
        {
            if (this.Identity != null && this.SharePointUrl != null)
            {
                base.WriteError(new InvalidOperationException(Strings.TestTeamMailboxConstraintError("Identity", "SharePointUrl")), ErrorCategory.InvalidOperation, null);
            }
            else if (this.Identity == null && this.SharePointUrl == null)
            {
                base.WriteError(new InvalidOperationException(Strings.TestTeamMailboxConstraintError("Identity", "SharePointUrl")), ErrorCategory.InvalidOperation, null);
            }
            if (this.UseAppTokenOnly && this.RequestorIdentity != null)
            {
                base.WriteError(new InvalidOperationException(Strings.TestTeamMailboxConstraintError("UseAppTokenOnly", "RequestorIdentity")), ErrorCategory.InvalidOperation, null);
            }
            ADObjectId adobjectId = null;

            base.TryGetExecutingUserId(out adobjectId);
            if (this.RequestorIdentity == null)
            {
                if (adobjectId == null)
                {
                    base.WriteError(new InvalidOperationException(Strings.CouldNotGetExecutingUser), ErrorCategory.InvalidOperation, null);
                }
                try
                {
                    this.requestor = (ADUser)base.GetDataObject(new RecipientIdParameter(adobjectId));
                    goto IL_145;
                }
                catch (ManagementObjectNotFoundException)
                {
                    if (this.UseAppTokenOnly && base.Organization != null)
                    {
                        this.requestor = null;
                        goto IL_145;
                    }
                    throw;
                }
            }
            this.requestor = (ADUser)base.GetDataObject(this.RequestorIdentity);
            if (adobjectId != this.requestor.Id)
            {
                this.additionalConstrainedIdentity = this.requestor.Id;
            }
IL_145:
            if (this.Identity != null)
            {
                base.InternalValidate();
                if (base.TMPrincipals.Count > 1)
                {
                    base.WriteError(new InvalidOperationException(Strings.MoreThanOneTeamMailboxes), ErrorCategory.InvalidOperation, null);
                }
                using (Dictionary <ADUser, ExchangePrincipal> .KeyCollection.Enumerator enumerator = base.TMPrincipals.Keys.GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        ADUser aduser = enumerator.Current;
                        this.tmADObject = aduser;
                        if (this.tmADObject.SharePointUrl == null)
                        {
                            base.WriteError(new InvalidOperationException(Strings.TeamMailboxSharePointUrlMissing), ErrorCategory.InvalidOperation, null);
                        }
                    }
                }
            }
        }
 static void MoveEnumerator()
 {
     if (!enumerator.MoveNext())
     {
         enumerator = BoardsPaths.GetEnumerator();
         enumerator.MoveNext();
     }
 }
Exemple #47
0
    private void method_1(Paragraph A_0, ParagraphFormat A_1)
    {
        if (A_0 == null)
        {
            return;
        }
        if (A_1.method_31(0x3e8) == null)
        {
            goto Label_00B8;
        }
        int    num2 = (int)A_1.method_31(0x3e8);
        string str2 = string.Empty;

        using (Dictionary <string, int> .Enumerator enumerator2 = this.class764_0.method_47().GetEnumerator())
        {
            KeyValuePair <string, int> current;
            while (enumerator2.MoveNext())
            {
                current = enumerator2.Current;
                if (current.Value == num2)
                {
                    goto Label_0065;
                }
            }
            goto Label_007E;
Label_0065:
            str2 = current.Key;
        }
Label_007E:
        if (this.document_0.StyleNameIds.ContainsValue(str2))
        {
            IParagraphStyle style2 = this.document_0.Styles.FindByName(str2, StyleType.ParagraphStyle) as IParagraphStyle;
            if (style2 != null)
            {
                A_0.method_65(style2);
            }
        }
Label_00B8:
        if ((A_1.FormatRevision == null) || (A_1.FormatRevision.method_4().method_31(0x3e8) == null))
        {
            return;
        }
        int    num = (int)A_1.FormatRevision.method_4().method_31(0x3e8);
        string str = string.Empty;

        using (Dictionary <string, int> .Enumerator enumerator = this.class764_0.method_47().GetEnumerator())
        {
            KeyValuePair <string, int> pair;
            while (enumerator.MoveNext())
            {
                pair = enumerator.Current;
                if (pair.Value == num)
                {
                    goto Label_0131;
                }
            }
            goto Label_0149;
Label_0131:
            str = pair.Key;
        }
Label_0149:
        if (this.document_0.StyleNameIds.ContainsValue(str))
        {
            IParagraphStyle style = this.document_0.Styles.FindByName(str, StyleType.ParagraphStyle) as IParagraphStyle;
            if (style != null)
            {
                A_1.FormatRevision.method_4().ApplyBase(style.ParagraphFormat);
            }
        }
    }
Exemple #48
0
 private void LateUpdate()
 {
     if (!RelevanceSystem.ENABLED)
     {
         return;
     }
     Dictionary <GameObject, Relevance> .Enumerator enumerator = this.m_Components.GetEnumerator();
     while (enumerator.MoveNext())
     {
         KeyValuePair <GameObject, Relevance> keyValuePair = enumerator.Current;
         Relevance value = keyValuePair.Value;
         if (value && value.enabled && value.LastUpdate <= Time.time - 0.5f)
         {
             value.LastUpdate = Time.time + UnityEngine.Random.Range(0f, 0.2f);
             Relevance.ERelevanceCalculationResult erelevanceCalculationResult;
             float num = value.CalculateRelevance(ReplTools.GetLocalPeer(), out erelevanceCalculationResult);
             if (num >= 0.2f && !value.gameObject.activeSelf)
             {
                 value.gameObject.SetActive(true);
                 value.OnRelevanceActivated(ReplTools.GetLocalPeer());
             }
             bool flag = false;
             if (value.ReplIsOwner())
             {
                 bool    flag2   = value.ReplCanChangeOwnership() && !value.ReplIsTransferringOwnership() && value.m_CreationTime < Time.time - 1f;
                 P2PPeer p2PPeer = null;
                 float   num2    = 0f;
                 for (int i = 0; i < ReplTools.GetRemotePeers().Count; i++)
                 {
                     P2PPeer p2PPeer2 = ReplTools.GetRemotePeers()[i];
                     float   num3     = value.CalculateRelevance(p2PPeer2, out erelevanceCalculationResult);
                     if (erelevanceCalculationResult == Relevance.ERelevanceCalculationResult.ToActivate)
                     {
                         value.OnRelevanceActivated(p2PPeer2);
                     }
                     else if (erelevanceCalculationResult == Relevance.ERelevanceCalculationResult.ToDeactivate)
                     {
                         value.OnRelevanceDeactivated(p2PPeer2);
                     }
                     if (flag2 && num3 > num2 && (num <= 0f || num3 > num + 0.1f))
                     {
                         num2    = num3;
                         p2PPeer = p2PPeer2;
                     }
                 }
                 if (p2PPeer != null)
                 {
                     value.ReplGiveOwnership(p2PPeer);
                 }
                 if (num <= 0f && value.CanBeRemovedByRelevance(true) && !value.ReplIsTransferringOwnership())
                 {
                     UnityEngine.Object.Destroy(value.gameObject);
                     flag = true;
                 }
             }
             if (!flag && num <= 0.1f && value.gameObject.activeSelf)
             {
                 value.gameObject.SetActive(false);
                 value.OnRelevanceDeactivated(ReplTools.GetLocalPeer());
             }
         }
     }
     enumerator.Dispose();
 }
        /// <summary>
        ///     This method is called by the LLUDPServer and should never be called by anyone else
        ///     It loops through the available updates and sends them out (no waiting)
        /// </summary>
        /// <param name="numPrimUpdates">The number of prim updates to send</param>
        /// <param name="numAvaUpdates">The number of avatar updates to send</param>
        public void SendPrimUpdates(int numPrimUpdates, int numAvaUpdates)
        {
            if (m_numberOfLoops < NUMBER_OF_LOOPS_TO_WAIT)
            //Wait for the client to finish connecting fully before sending out bunches of updates
            {
                m_numberOfLoops++;
                return;
            }

            if (m_inUse || m_presence.IsInTransit)
            {
                return;
            }

            m_inUse = true;
            //This is for stats
            int AgentMS = Util.EnvironmentTickCount();

            #region New client entering the Scene, requires all objects in the Scene

            //If we havn't started processing this client yet, we need to send them ALL the prims that we have in this Scene (and deal with culling as well...)
            if (!m_SentInitialObjects && m_presence.DrawDistance != 0.0f)
            {
                SendInitialObjects();
            }

            int presenceNumToSend       = numAvaUpdates;
            List <EntityUpdate> updates = new List <EntityUpdate>();
            lock (m_presenceUpdatesToSendLock)
            {
                //Send the numUpdates of them if that many
                // if we don't have that many, we send as many as possible, then switch to objects
                if (m_presenceUpdatesToSend.Count != 0)
                {
                    try
                    {
#if UseDictionaryForEntityUpdates
                        Dictionary <uint, EntityUpdate> .Enumerator e = m_presenceUpdatesToSend.GetEnumerator();
                        e.MoveNext();
                        List <uint> entitiesToRemove = new List <uint>();
#endif
                        int count = m_presenceUpdatesToSend.Count > presenceNumToSend
                                        ? presenceNumToSend
                                        : m_presenceUpdatesToSend.Count;
                        for (int i = 0; i < count; i++)
                        {
#if UseRemovingEntityUpdates
                            EntityUpdate update = ((EntityUpdate)m_presenceUpdatesToSend[0]);

                            /*if (m_EntitiesInPacketQueue.Contains (update.Entity.UUID))
                             * {
                             *  m_presenceUpdatesToSend.RemoveAt (0);
                             *  m_presenceUpdatesToSend.Insert (m_presenceUpdatesToSend.Count, update.Entity.UUID, update);
                             *  continue;
                             * }
                             * m_EntitiesInPacketQueue.Add (update.Entity.UUID);*/
                            m_presenceUpdatesToSend.RemoveAt(0);
                            if (update.Flags == PrimUpdateFlags.ForcedFullUpdate)
                            {
                                SendFullUpdateForPresence((IScenePresence)update.Entity);
                            }
                            else
                            {
                                updates.Add(update);
                            }
#elif UseDictionaryForEntityUpdates
                            EntityUpdate update = e.Current.Value;
                            entitiesToRemove.Add(update.Entity.LocalId); //Remove it later
                            if (update.Flags == PrimUpdateFlags.ForcedFullUpdate)
                            {
                                SendFullUpdateForPresence((IScenePresence)update.Entity);
                            }
                            else if (!((IScenePresence)update.Entity).IsChildAgent)
                            {
                                updates.Add(update);
                            }
                            e.MoveNext();
#else
                            EntityUpdate update = m_presenceUpdatesToSend.Dequeue();
                            if (update.Flags == PrimUpdateFlags.ForcedFullUpdate)
                            {
                                SendFullUpdateForPresence((IScenePresence)update.Entity);
                            }
                            else
                            {
                                updates.Add(update);
                            }
#endif
                        }
#if UseDictionaryForEntityUpdates
                        foreach (uint id in entitiesToRemove)
                        {
                            m_presenceUpdatesToSend.Remove(id);
                        }
#endif
                    }
                    catch (Exception ex)
                    {
                        MainConsole.Instance.WarnFormat("[SceneViewer]: Exception while running presence loop: {0}", ex);
                    }
                }
            }
            if (updates.Count != 0)
            {
                presenceNumToSend -= updates.Count;
                m_presence.ControllingClient.SendAvatarUpdate(updates);
            }
            updates.Clear();

            List <AnimationGroup> animationsToSend = new List <AnimationGroup>();
            lock (m_presenceAnimationsToSendLock)
            {
                //Send the numUpdates of them if that many
                // if we don't have that many, we send as many as possible, then switch to objects
                if (m_presenceAnimationsToSend.Count != 0 && presenceNumToSend > 0)
                {
                    try
                    {
                        int count = m_presenceAnimationsToSend.Count > presenceNumToSend
                                        ? presenceNumToSend
                                        : m_presenceAnimationsToSend.Count;
                        for (int i = 0; i < count; i++)
                        {
                            AnimationGroup update = m_presenceAnimationsToSend.Dequeue();

                            /*if (m_AnimationsInPacketQueue.Contains (update.AvatarID))
                             * {
                             *  m_presenceAnimationsToSend.RemoveAt (0);
                             *  m_presenceAnimationsToSend.Insert (m_presenceAnimationsToSend.Count, update.AvatarID, update);
                             *  continue;
                             * }
                             * m_AnimationsInPacketQueue.Add (update.AvatarID);*/
                            animationsToSend.Add(update);
                        }
                    }
                    catch (Exception ex)
                    {
                        MainConsole.Instance.WarnFormat("[SceneViewer]: Exception while running presence loop: {0}", ex);
                    }
                }
            }
            foreach (AnimationGroup update in animationsToSend)
            {
                m_presence.ControllingClient.SendAnimations(update);
            }
            animationsToSend.Clear();

            int primsNumToSend = numPrimUpdates;

            List <IEntity> entities = new List <IEntity>();
            lock (m_objectPropertiesToSendLock)
            {
                //Send the numUpdates of them if that many
                // if we don't have that many, we send as many as possible, then switch to objects
                if (m_objectPropertiesToSend.Count != 0)
                {
                    try
                    {
                        int count = m_objectPropertiesToSend.Count > primsNumToSend
                                        ? primsNumToSend
                                        : m_objectPropertiesToSend.Count;
                        for (int i = 0; i < count; i++)
                        {
                            ISceneChildEntity entity = ((ISceneChildEntity)m_objectPropertiesToSend[0]);

                            /*if (m_PropertiesInPacketQueue.Contains (entity.UUID))
                             * {
                             *  m_objectPropertiesToSend.RemoveAt (0);
                             *  m_objectPropertiesToSend.Insert (m_objectPropertiesToSend.Count, entity.UUID, entity);
                             *  continue;
                             * }
                             * m_PropertiesInPacketQueue.Add (entity.UUID);*/
                            m_objectPropertiesToSend.RemoveAt(0);
                            entities.Add(entity);
                        }
                    }
                    catch (Exception ex)
                    {
                        MainConsole.Instance.WarnFormat("[SceneViewer]: Exception while running presence loop: {0}", ex);
                    }
                }
            }
            if (entities.Count > 0)
            {
                primsNumToSend -= entities.Count;
                m_presence.ControllingClient.SendObjectPropertiesReply(entities);
            }

            updates = new List <EntityUpdate>();
            lock (m_objectUpdatesToSendLock)
            {
                if (m_objectUpdatesToSend.Count != 0)
                {
                    try
                    {
                        int count = m_objectUpdatesToSend.Count > primsNumToSend
                                        ? primsNumToSend
                                        : m_objectUpdatesToSend.Count;
                        for (int i = 0; i < count; i++)
                        {
                            EntityUpdate update = ((EntityUpdate)m_objectUpdatesToSend[0]);
                            //Fix the CRC for this update
                            //Increment the CRC code so that the client won't be sent a cached update for this
                            if (update.Flags != PrimUpdateFlags.PrimFlags)
                            {
                                ((ISceneChildEntity)update.Entity).CRC++;
                            }

                            updates.Add(update);
                            m_objectUpdatesToSend.RemoveAt(0);
                        }
                    }
                    catch (Exception ex)
                    {
                        MainConsole.Instance.WarnFormat("[SceneViewer]: Exception while running object loop: {0}", ex);
                    }
                    m_presence.ControllingClient.SendPrimUpdate(updates);
                }
            }


            //Add the time to the stats tracker
            IAgentUpdateMonitor reporter =
                m_presence.Scene.RequestModuleInterface <IMonitorModule>().GetMonitor <IAgentUpdateMonitor>(m_presence.Scene);
            if (reporter != null)
            {
                reporter.AddAgentTime(Util.EnvironmentTickCountSubtract(AgentMS));
            }

            m_inUse = false;
        }
        private void processRotationAbility()
        {
            Regex rgx;

            if (phases.ContainsKey(_phase))
            {
                if (phases[_phase].rotationAbilities.Any())
                {
                    string debugOut = nextRotationAbility.warningMessage + " warning time. ";
                    if (nextRotationAbility.announceWarning)
                    {
                        string message = parseMessage(nextRotationAbility, nextRotationAbility.warningMessage);

                        tts(message);
                    }

                    RotationAbility tmpAbil = nextRotationAbility;



                    if (!nextRotationEnumerator.MoveNext())
                    {
                        nextRotationEnumerator = phases[_phase].rotationAbilitiesWarningTime.GetEnumerator();
                        nextRotationEnumerator.MoveNext();

                        phases[_phase].phaseStarted = phases[_phase].phaseStarted + phases[_phase].phaseLength;
                    }

                    nextRotationTime = phases[_phase].phaseStarted + nextRotationEnumerator.Current.Key;
                    nextRotationAbility = nextRotationEnumerator.Current.Value;

                    debugOut += "nextRotationTime: " + nextRotationTime + " nextRotationAbility: " + nextRotationAbility.warningMessage;

                    EncounterController.debug(debugOut, DBMErrorLevel.FineTimings);

                    // Need to call this after moving to the next rotation
                    // otherwise the callback may swap phases, and we'd then skip the first rotation in the next phase
                    if (tmpAbil.warningCallback != null)
                    {
                        _inController = false;
                        tmpAbil.warningCallback(tmpAbil);
                        _inController = true;
                    }

                }
            }
        }
Exemple #51
0
        private void RefreshFinishedStatus()
        {
            if (this.mSelectExpItems == null || this.mSelectExpItems.Count <= 0)
            {
                return;
            }
            int num1 = 0;

            using (Dictionary <string, int> .KeyCollection.Enumerator enumerator = this.mSelectExpItems.Keys.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string   current          = enumerator.Current;
                    ItemData itemDataByItemId = this.player.FindItemDataByItemID(current);
                    if (itemDataByItemId != null)
                    {
                        int mSelectExpItem = this.mSelectExpItems[current];
                        if (mSelectExpItem != 0 && mSelectExpItem <= itemDataByItemId.Num)
                        {
                            int num2 = itemDataByItemId.Param.value * mSelectExpItem;
                            num1 += num2;
                        }
                    }
                }
            }
            int gainExpCap = this.mOriginUnit.GetGainExpCap(this.player.Lv);

            this.mExp = Math.Min(this.mOriginUnit.Exp + num1, gainExpCap);
            this.mLv  = this.master.CalcUnitLevel(this.mExp, this.mOriginUnit.GetLevelCap(false));
            using (List <UnitLevelUpListItem> .Enumerator enumerator = this.mUnitLevelupLists.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    enumerator.Current.SetInputLock(this.mExp < gainExpCap);
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.FinishedLevel, (UnityEngine.Object)null))
            {
                this.FinishedLevel.set_text(this.mLv.ToString());
                if (this.mLv >= this.mOriginUnit.GetLevelCap(false))
                {
                    ((Graphic)this.FinishedLevel).set_color(Color.get_red());
                }
                else if (this.mLv > this.mOriginUnit.Lv)
                {
                    ((Graphic)this.FinishedLevel).set_color(Color.get_green());
                }
                else
                {
                    ((Graphic)this.FinishedLevel).set_color(Color.get_white());
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AddLevelGauge, (UnityEngine.Object)null))
            {
                if (this.mExp == this.mOriginUnit.GetExp() || num1 == 0)
                {
                    this.AddLevelGauge.AnimateValue(0.0f, 0.0f);
                }
                else
                {
                    this.AddLevelGauge.AnimateValue(Mathf.Min(1f, Mathf.Clamp01((float)(this.mExp - this.master.GetUnitLevelExp(this.mOriginUnit.Lv)) / (float)this.master.GetUnitNextExp(this.mOriginUnit.Lv))), 0.0f);
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.NextExp, (UnityEngine.Object)null))
            {
                int num2 = 0;
                if (this.mExp < this.mOriginUnit.GetGainExpCap(this.player.Lv))
                {
                    int unitLevelExp = this.master.GetUnitLevelExp(this.mLv);
                    int unitNextExp  = this.master.GetUnitNextExp(this.mLv);
                    if (this.mExp >= unitLevelExp)
                    {
                        unitNextExp = this.master.GetUnitNextExp(Math.Min(this.mOriginUnit.GetLevelCap(false), this.mLv + 1));
                    }
                    int num3 = this.mExp - unitLevelExp;
                    num2 = Math.Max(0, unitNextExp <= num3 ? 0 : unitNextExp - num3);
                }
                this.NextExp.set_text(num2.ToString());
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.GetAllExp, (UnityEngine.Object)null))
            {
                this.GetAllExp.set_text(num1.ToString());
            }
            ((Selectable)this.DecideBtn).set_interactable(num1 > 0);
        }
Exemple #52
0
 // Select the next shader
 public void GotoNext()
 {
     if (myIterator.MoveNext() == false)
     {
         myIterator = myOwner.GetEnumerator();
         myIterator.MoveNext();
     }
 }
Exemple #53
0
 private void SetActiveControlMapSelect(bool active)
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     CharaMigrateUI.\u003CSetActiveControlMapSelect\u003Ec__AnonStoreyD selectCAnonStoreyD = new CharaMigrateUI.\u003CSetActiveControlMapSelect\u003Ec__AnonStoreyD();
     // ISSUE: reference to a compiler-generated field
     selectCAnonStoreyD.active = active;
     // ISSUE: reference to a compiler-generated field
     selectCAnonStoreyD.\u0024this = this;
     Manager.Input instance = Singleton <Manager.Input> .Instance;
     // ISSUE: reference to a compiler-generated field
     if (selectCAnonStoreyD.active)
     {
         foreach (MigrateMapSelectNodeUI node in this._nodes)
         {
             if (!Object.op_Equality((Object)node, (Object)null))
             {
                 Object.Destroy((Object)((UnityEngine.Component)node).get_gameObject());
             }
         }
         this._nodes.Clear();
         using (Dictionary <int, AssetBundleInfo> .Enumerator enumerator = Singleton <Resources> .Instance.Map.MapList.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 KeyValuePair <int, AssetBundleInfo> current = enumerator.Current;
                 // ISSUE: object of a compiler-generated type is created
                 // ISSUE: variable of a compiler-generated type
                 CharaMigrateUI.\u003CSetActiveControlMapSelect\u003Ec__AnonStoreyC selectCAnonStoreyC = new CharaMigrateUI.\u003CSetActiveControlMapSelect\u003Ec__AnonStoreyC();
                 // ISSUE: reference to a compiler-generated field
                 selectCAnonStoreyC.\u003C\u003Ef__ref\u002413 = selectCAnonStoreyD;
                 // ISSUE: reference to a compiler-generated field
                 selectCAnonStoreyC.node = (MigrateMapSelectNodeUI)((GameObject)Object.Instantiate <GameObject>((M0)((UnityEngine.Component) this._mapSelectNode).get_gameObject(), (Transform)this._scrollRect.get_content(), false)).GetComponent <MigrateMapSelectNodeUI>();
                 // ISSUE: reference to a compiler-generated field
                 selectCAnonStoreyC.id = current.Key;
                 // ISSUE: reference to a compiler-generated field
                 selectCAnonStoreyC.mapName = (string)current.Value.name;
                 // ISSUE: reference to a compiler-generated field
                 // ISSUE: reference to a compiler-generated field
                 selectCAnonStoreyC.node.Text.set_text(selectCAnonStoreyC.mapName);
                 // ISSUE: reference to a compiler-generated field
                 // ISSUE: method pointer
                 ((UnityEvent)selectCAnonStoreyC.node.Button.get_onClick()).AddListener(new UnityAction((object)selectCAnonStoreyC, __methodptr(\u003C\u003Em__0)));
                 // ISSUE: reference to a compiler-generated field
                 ((UnityEngine.Component)selectCAnonStoreyC.node).get_gameObject().SetActiveIfDifferent(true);
                 // ISSUE: reference to a compiler-generated field
                 this._nodes.Add(selectCAnonStoreyC.node);
             }
         }
         // ISSUE: reference to a compiler-generated field
         selectCAnonStoreyD.coroutine = this.OpenMapSelectCoroutine();
     }
     else
     {
         // ISSUE: reference to a compiler-generated field
         selectCAnonStoreyD.coroutine = this.CloseMapSelectCoroutine();
     }
     if (this._fadeMapSelectDisposable != null)
     {
         this._fadeMapSelectDisposable.Dispose();
     }
     // ISSUE: reference to a compiler-generated method
     // ISSUE: reference to a compiler-generated method
     this._fadeMapSelectDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)Observable.FromCoroutine(new Func <IEnumerator>(selectCAnonStoreyD.\u003C\u003Em__0), false), (System.Action <M0>)(_ => {}), (System.Action <Exception>)(ex => Debug.LogException(ex)), new System.Action(selectCAnonStoreyD.\u003C\u003Em__1));
 }
Exemple #54
0
        private static void AddCustomAttributes(XmlNode parentNode, Dictionary<string, IPolicyLanguageItem>.Enumerator attributesEnumerator)
        {
            while (attributesEnumerator.MoveNext())
            {
                KeyValuePair<string, IPolicyLanguageItem> attribute = attributesEnumerator.Current;

                if (attribute.Value is NonTranslateableLanguageItem)
                {
                    AddAttribute(parentNode, attribute.Key, attribute.Value.Value);
                }
                else
                {
                    AddAttribute(parentNode, attribute.Key, attribute.Value.Identifier);
                }
            }
        }
 public bool MoveNext()
 {
     return(inner.MoveNext());
 }